@@ -10,17 +10,19 @@ type ViteFixtures = {
1010 baseURL : string
1111 projectRoot : string
1212 applyEditFile : ( sourceFilePath : string , newContentFilePath : string ) => void
13+ playgroundName : string
1314}
1415
15- const sourceDir = fileURLToPath ( new URL ( '../playground' , import . meta. url ) )
16-
1716export const test = base . extend < ViteFixtures > ( {
17+ // @ts -expect-error: all options are scoped per worker
18+ playgroundName : [ '' , { scope : 'worker' , option : true } ] ,
19+
1820 // @ts -expect-error: we need to compute projectRoot per worker
1921 projectRoot : [
20- async ( { } , use , testInfo ) => {
22+ async ( { playgroundName } , use , testInfo ) => {
2123 const fixtureDir = fileURLToPath (
2224 new URL (
23- `../playground-tmp-worker-${ testInfo . workerIndex } ` ,
25+ `../playground-tmp-${ playgroundName } - worker-${ testInfo . workerIndex } ` ,
2426 import . meta. url
2527 )
2628 )
@@ -32,8 +34,9 @@ export const test = base.extend<ViteFixtures>({
3234
3335 // @ts -expect-error: type matched what is passed to use(server)
3436 devServer : [
35- async ( { projectRoot } , use ) => {
37+ async ( { projectRoot, playgroundName } , use ) => {
3638 const fixtureDir = projectRoot
39+ const sourceDir = fileURLToPath ( new URL ( `../playground` , import . meta. url ) )
3740
3841 fs . rmSync ( fixtureDir , { force : true , recursive : true } )
3942 fs . cpSync ( sourceDir , fixtureDir , {
@@ -50,7 +53,7 @@ export const test = base.extend<ViteFixtures>({
5053 // Start a real Vite dev server with your plugin(s) & config.
5154 // If you already have vite.config.ts, omit configFile:false and rely on it.
5255 const server = await createServer ( {
53- configFile : path . join ( fixtureDir , ' vite.config.ts' ) ,
56+ configFile : path . join ( fixtureDir , ` vite.config.${ playgroundName } .ts` ) ,
5457 // If you need to inline the plugin directly, you could do:
5558 // configFile: false,
5659 // plugins: [myPlugin()],
0 commit comments