Files
ComfyUI_frontend/playwright.i18n.config.ts
snomiao 4ea2987502 fix: Convert babel plugin to CommonJS format for Playwright compatibility
- Renamed babel-plugin-stub-vue-imports.js to .cjs extension
- Changed from ES module exports to CommonJS module.exports
- Updated playwright.i18n.config.ts to use correct file path with __dirname
- Added import.meta.url handling for ES module compatibility

This fixes the module resolution errors when running pnpm collect-i18n
2025-09-12 08:47:43 +00:00

52 lines
1.2 KiB
TypeScript

import { defineConfig } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const config: any = defineConfig({
testDir: './scripts',
use: {
baseURL: 'http://localhost:5173',
headless: true
},
reporter: 'list',
timeout: 60000,
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
[path.join(__dirname, 'babel-plugin-stub-vue-imports.cjs')],
// 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