Skip to content

Commit 9920d72

Browse files
committed
chore: setup tests
1 parent 26479d9 commit 9920d72

File tree

3 files changed

+404
-23
lines changed

3 files changed

+404
-23
lines changed

packages/plugin-react-oxc/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"vite": "^6.3.0"
3838
},
3939
"devDependencies": {
40-
"unbuild": "^3.5.0"
40+
"unbuild": "^3.5.0",
41+
"vite": "npm:[email protected]"
4142
}
4243
}

playground/vitestGlobalSetup.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4889
export async function teardown(): Promise<void> {

0 commit comments

Comments
 (0)