Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/i18n-update-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
jobs:
update-locales:
# Branch detection: Only run for manual dispatch or version-bump-* branches from main repo
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'version-bump-'))
if: |
github.event_name == 'workflow_dispatch'
|| (github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'version-bump-'))
|| (github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'sno-'))
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
4 changes: 3 additions & 1 deletion knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const config: KnipConfig = {
'@primeuix/forms',
'@primeuix/styled',
'@primeuix/utils',
'@primevue/icons'
'@primevue/icons',
// Used by Playwright's Babel configuration for i18n tests
'babel-plugin-module-resolver'
],
ignore: [
// Auto generated manager types
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@vitest/ui": "catalog:",
"@vue/test-utils": "catalog:",
"@webgpu/types": "catalog:",
"babel-plugin-module-resolver": "catalog:",
"cross-env": "catalog:",
"eslint": "catalog:",
"eslint-config-prettier": "catalog:",
Expand Down
52 changes: 50 additions & 2 deletions playwright.i18n.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { defineConfig } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'

export default defineConfig({
const __dirname = path.dirname(fileURLToPath(import.meta.url))

const config = defineConfig({
testDir: './scripts',
use: {
baseURL: 'http://localhost:5173',
Expand All @@ -9,5 +13,49 @@ export default defineConfig({
reporter: 'list',
workers: 1,
timeout: 60000,
testMatch: /collect-i18n-.*\.ts/
testMatch: /collect-i18n-.*\.ts/,
webServer: {
command: 'pnpm dev',
url: 'http://localhost:5173',
reuseExistingServer: true,
timeout: 120000
}
})

// Add Babel plugins for handling TypeScript and Vite defines

;(config as any)['@playwright/test'] = {
babelPlugins: [
// Module resolver for @ alias
[
'babel-plugin-module-resolver',
{
root: ['./'],
alias: { '@': './src' }
}
],

// TypeScript transformation with declare fields support
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
onlyRemoveTypeImports: true
}
],

// Custom plugin to replace Vite define constants
[path.join(__dirname, 'scripts/babel-plugin-vite-define.cjs')],

// Inject browser globals setup for i18n collection tests
[
path.join(__dirname, 'scripts/babel-plugin-inject-globals.cjs'),
{
filenamePattern: 'collect-i18n-',
setupFile: './setup-i18n-globals.mjs'
}
]
Comment on lines +51 to +57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Checking setup file existence ==="
fd -t f 'setup-i18n-globals.mjs'

echo -e "\n=== Checking inject-globals plugin implementation ==="
cat scripts/babel-plugin-inject-globals.cjs 2>/dev/null || echo "File not found"

echo -e "\n=== Listing scripts directory ==="
ls -la scripts/ | grep -E '\.(cjs|mjs)$'

Repository: Comfy-Org/ComfyUI_frontend

Length of output: 1924


Use absolute path for setupFile to ensure correct resolution from test files.

The setupFile: './setup-i18n-globals.mjs' is a relative path that gets injected directly into test files as an import statement. Since test files are in the test/ directory, this relative path will fail to resolve. Use an absolute path instead:

    [
      path.join(__dirname, 'scripts/babel-plugin-inject-globals.cjs'),
      {
        filenamePattern: 'collect-i18n-',
-       setupFile: './setup-i18n-globals.mjs'
+       setupFile: path.join(__dirname, 'scripts/setup-i18n-globals.mjs')
      }
    ]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[
path.join(__dirname, 'scripts/babel-plugin-inject-globals.cjs'),
{
filenamePattern: 'collect-i18n-',
setupFile: './setup-i18n-globals.mjs'
}
]
[
path.join(__dirname, 'scripts/babel-plugin-inject-globals.cjs'),
{
filenamePattern: 'collect-i18n-',
setupFile: path.join(__dirname, 'scripts/setup-i18n-globals.mjs')
}
]
🤖 Prompt for AI Agents
In playwright.i18n.config.ts around lines 51 to 57, the plugin option uses a
relative setupFile ('./setup-i18n-globals.mjs') which will be injected into
tests and fail to resolve from the test/ directory; change it to an absolute
path (built from __dirname, e.g. path.join/__dirname or path.resolve to the
setup-i18n-globals.mjs file) so the injected import is an absolute path that
resolves regardless of the test file location.

]
}

export default config
Loading