mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-23 07:50:15 +00:00
fix: Add babel configuration for Playwright to handle TypeScript declare fields
- Configure babel plugins for TypeScript with allowDeclareFields option - Add module resolver for @ alias to src directory - Create custom babel plugin to stub Vue/CSS imports - Add browser globals polyfill using happy-dom for Node.js context - Update playwright.i18n.config.ts with babel configuration This enables collect-i18n tests to run with proper TypeScript and module transformations.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { defineConfig } from '@playwright/test'
|
||||
|
||||
export default defineConfig({
|
||||
const config: any = defineConfig({
|
||||
testDir: './scripts',
|
||||
use: {
|
||||
baseURL: 'http://localhost:5173',
|
||||
@@ -8,5 +8,40 @@ export default defineConfig({
|
||||
},
|
||||
reporter: 'list',
|
||||
timeout: 60000,
|
||||
testMatch: /collect-i18n-.*\.ts/
|
||||
testMatch: /collect-i18n-.*\.ts/,
|
||||
// Start dev server before running tests
|
||||
webServer: {
|
||||
command: 'pnpm dev',
|
||||
url: 'http://localhost:5173',
|
||||
reuseExistingServer: true,
|
||||
timeout: 60000
|
||||
}
|
||||
})
|
||||
|
||||
// Configure babel plugins for TypeScript with declare fields and module resolution
|
||||
config['@playwright/test'] = {
|
||||
babelPlugins: [
|
||||
// Stub Vue and CSS imports first to prevent parsing errors
|
||||
['babel-plugin-stub-vue-imports'],
|
||||
// Module resolver to handle @ alias
|
||||
[
|
||||
'babel-plugin-module-resolver',
|
||||
{
|
||||
root: ['./'],
|
||||
alias: {
|
||||
'@': './src'
|
||||
}
|
||||
}
|
||||
],
|
||||
// Then TypeScript transformation with declare field support
|
||||
[
|
||||
'@babel/plugin-transform-typescript',
|
||||
{
|
||||
allowDeclareFields: true,
|
||||
onlyRemoveTypeImports: true
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
export default config
|
||||
|
||||
Reference in New Issue
Block a user