-
Notifications
You must be signed in to change notification settings - Fork 392
chore(chrome-extension): Replace Jest with Vitest #6820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2f8d760
cc5e91f
5f196e6
68b09e8
4cd72fc
0f06a7a
9284441
4302356
ceb14d8
1203c64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,10 +44,9 @@ | |
"lint:attw": "attw --pack . --profile node16", | ||
"lint:publint": "publint", | ||
"publish:local": "pnpm yalc push --replace --sig", | ||
"test": "jest", | ||
"test:cache:clear": "jest --clearCache --useStderr", | ||
"test:ci": "jest --maxWorkers=70%", | ||
"test:coverage": "jest --collectCoverage && open coverage/lcov-report/index.html" | ||
"test": "vitest run", | ||
"test:ci": "vitest run --maxWorkers=70%", | ||
"test:watch": "vitest" | ||
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVitest switch LGTM; please verify flag support and workspace bin resolution
🏁 Script executed: #!/bin/bash
# 1) Check Vitest version at repo root
jq -r '.devDependencies.vitest // .dependencies.vitest // .pnpm.overrides.vitest // empty' package.json
# 2) Verify this package does not declare vitest (expected if using root toolchain)
jq -r '.devDependencies.vitest // empty' packages/chrome-extension/package.json
# 3) (Optional) Inspect root scripts to see how tests are invoked in CI
jq -r '.scripts | to_entries[] | select(.key|test("test|ci|vitest|coverage")) | "\(.key): \(.value)"' package.json Length of output: 2613 🌐 Web query:
💡 Result: Yes. Vitest's maxWorkers accepts numeric or percentage values (e.g. --maxWorkers=70%). It was added in the v1.1.0 release (Dec 19, 2023), and a parsing fix for --maxWorkers/--minWorkers was applied in Jan 2024 (PR #7759). [1][2][3] Sources:
Add Vitest devDependency and confirm flag support 🤖 Prompt for AI Agents
|
||
}, | ||
"dependencies": { | ||
"@clerk/clerk-js": "workspace:^", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import { readFileSync } from 'node:fs'; | ||
|
||
const { name, version } = JSON.parse(readFileSync('./package.json', 'utf8')); | ||
|
||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make config CWD‑independent (monorepo‑safe). Relative paths here resolve from process.cwd(), which can point to the repo root when running Vitest via a workspace filter. Read package.json and resolve tsconfig/setupFiles relative to this config file to avoid misreads/breakage. Apply this diff: @@
-import { defineConfig } from 'vitest/config';
-import { readFileSync } from 'node:fs';
+import { defineConfig } from 'vitest/config';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { resolve } from 'node:path';
@@
-const { name, version } = JSON.parse(readFileSync('./package.json', 'utf8'));
+const rootDir = fileURLToPath(new URL('.', import.meta.url));
+const { name, version } = JSON.parse(
+ readFileSync(new URL('./package.json', import.meta.url), 'utf8'),
+);
@@
-export default defineConfig({
- plugins: [],
+export default defineConfig({
+ root: rootDir,
+ plugins: [],
@@
- tsconfig: './tsconfig.test.json',
+ tsconfig: resolve(rootDir, 'tsconfig.test.json'),
@@
- setupFiles: './vitest.setup.mts',
+ setupFiles: resolve(rootDir, 'vitest.setup.mts'), Also applies to: 6-9, 15-16, 23-23 🤖 Prompt for AI Agents
|
||
export default defineConfig({ | ||
plugins: [], | ||
define: { | ||
PACKAGE_NAME: JSON.stringify(name), | ||
PACKAGE_VERSION: JSON.stringify(version), | ||
}, | ||
test: { | ||
typecheck: { | ||
enabled: true, | ||
tsconfig: './tsconfig.test.json', | ||
include: ['**/*.test.{ts,tsx}'], | ||
}, | ||
env: { | ||
CLERK_SECRET_KEY: 'TEST_SECRET_KEY', | ||
}, | ||
environment: 'jsdom', | ||
includeSource: ['**/*.{js,ts,jsx,tsx}'], | ||
setupFiles: './vitest.setup.mts', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,7 +6,7 @@ | |||||
"importHelpers": true, | ||||||
"isolatedModules": true, | ||||||
"jsx": "react", | ||||||
"lib": ["es6", "dom"], | ||||||
"lib": ["es6", "dom", "dom.iterable"], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix lib/target mismatch: use ES2019 libs (or drop custom lib). Specifying "lib": ["es6", ...] while "target" is "ES2019" removes ES2016–ES2019 lib typings (Promise.finally, newer Array/TypedArray methods, etc.). Use ES2019 to match target (plus DOM libs) or omit "lib" entirely and rely on defaults if DOM isn’t required everywhere. - "lib": ["es6", "dom", "dom.iterable"],
+ "lib": ["es2019", "dom", "dom.iterable"], 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||
"module": "NodeNext", | ||||||
"moduleResolution": "NodeNext", | ||||||
"noImplicitReturns": true, | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.