Skip to content
Open
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
2 changes: 1 addition & 1 deletion lib/buildtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"esbuild": "^0.27.0",
"eslint": "^9.35.0",
"http-server": "^14.1.1",
"jsdom": "^26.1.0",
"jsdom": "^28.0.0",
"lodash": "^4.17.23",
"typedoc": "^0.28.9",
"vite": "^7.1.11",
Expand Down
1 change: 0 additions & 1 deletion lib/modules-lib/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default mergeConfig(
environment: 'jsdom',
browser: {
enabled: true,
// headless: true,
provider: playwright(),
instances: [{
browser: 'chromium',
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-yml": "^3.0.0",
"husky": "^9.1.7",
"jsdom": "^26.1.0",
"jsdom": "^28.0.0",
"jsonc-eslint-parser": "^2.4.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.33.1",
Expand Down Expand Up @@ -104,5 +104,8 @@
"./lib/*",
"./src/bundles/*",
"./src/tabs/*"
]
],
"resolutions": {
"cssstyle": "^4.6.0"
}
}
8 changes: 8 additions & 0 deletions src/tabs/Curve/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
// Curve Tab vitest.config
import pathlib from 'path';
import { defineProject } from 'vitest/config';

export default defineProject({
resolve: {
alias: [{
find: /^js-slang\/context/,
replacement: pathlib.join(import.meta.dirname, '../../__mocks__/context.ts')
}]
},
optimizeDeps: {
include: [
'js-slang',
'js-slang/dist/utils/stringify',
'lodash/clamp',
]
Expand Down
8 changes: 8 additions & 0 deletions src/tabs/Rune/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
// Rune Tab vitest.config.js
import pathlib from 'path';
import { defineProject } from 'vitest/config';

export default defineProject({
resolve: {
alias: [{
find: /^js-slang\/context/,
replacement: pathlib.join(import.meta.dirname, '../../__mocks__/context.ts')
}]
},
optimizeDeps: {
include: [
'lodash/clamp',
'js-slang',
'js-slang/dist/utils/stringify'
]
},
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default defineConfig({
}]
},
test: {
setupFiles: [pathlib.join(import.meta.dirname, 'vitest.setup.ts')],
projects: [
'./.github/actions',
'./devserver',
Expand Down
27 changes: 27 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Workaround for jsdom/undici compatibility issue
// See: https://github.com/nodejs/undici/issues/4000

// This setup file patches the global undici dispatcher to avoid
// "invalid onError method" errors during jsdom tests

try {
// Try to patch undici dispatcher
const undici = await import('undici');

// @ts-expect-error - undici types may not exist
if (typeof setGlobalDispatcher === 'function' && undici.Agent) {
// @ts-expect-error - setGlobalDispatcher may not be typed
setGlobalDispatcher(new undici.Agent());
}
} catch {
// Ignore if undici patching fails - this is expected in some environments
}

// Suppress unhandled rejection errors from jsdom/undici (Node.js only)
if (typeof process !== 'undefined' && process.on) {
process.on('unhandledRejection', (reason: any) => {
if (reason?.code === 'UND_ERR_INVALID_ARG') {
// Ignore undici invalid argument errors from jsdom cleanup
}
});
}
Loading
Loading