@@ -43,6 +43,47 @@ export async function setup(): Promise<void> {
4343 throw error
4444 }
4545 } )
46+
47+ // also setup dedicated copy for plugin-react-oxc tests
48+ const oxcIgnoredDirs = new Set ( [
49+ 'compiler' ,
50+ 'compiler-react-18' ,
51+ 'react-classic' ,
52+ 'react-emotion' ,
53+ 'node_modules' ,
54+ ] )
55+ const oxcPlaygrounds = (
56+ await fs . readdir ( path . resolve ( __dirname , '../playground' ) , {
57+ withFileTypes : true ,
58+ } )
59+ ) . filter ( ( dirent ) => ! oxcIgnoredDirs . has ( dirent . name ) && dirent . isDirectory ( ) )
60+ for ( const { name : playgroundName } of oxcPlaygrounds ) {
61+ await fs . copy (
62+ path . resolve ( tempDir , playgroundName ) ,
63+ path . resolve ( tempDir , `${ playgroundName } -oxc` ) ,
64+ )
65+ await fs . remove (
66+ path . resolve (
67+ tempDir ,
68+ `${ playgroundName } -oxc/node_modules/@vitejs/plugin-react` ,
69+ ) ,
70+ )
71+ await fs . symlink (
72+ path . resolve ( __dirname , '../packages/plugin-react-oxc' ) ,
73+ path . resolve (
74+ tempDir ,
75+ `${ playgroundName } -oxc/node_modules/@vitejs/plugin-react` ,
76+ ) ,
77+ )
78+ await fs . symlink (
79+ path . resolve ( __dirname , '../packages/plugin-react-oxc/node_modules/vite' ) ,
80+ path . resolve ( tempDir , `${ playgroundName } -oxc/node_modules/vite` ) ,
81+ )
82+ await fs . copy (
83+ path . resolve ( __dirname , '../packages/plugin-react-oxc/node_modules/.bin' ) ,
84+ path . resolve ( tempDir , `${ playgroundName } -oxc/node_modules/.bin` ) ,
85+ )
86+ }
4687}
4788
4889export async function teardown ( ) : Promise < void > {
0 commit comments