Skip to content

test: Update Vitest #16682

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

Merged
merged 12 commits into from
Jun 25, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"solid-devtools": "^0.29.2",
"tailwindcss": "^3.4.1",
"vite": "^5.4.11",
"vite-plugin-solid": "^2.8.2"
"vite-plugin-solid": "^2.11.6"
},
"dependencies": {
"@solidjs/router": "^0.13.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"solid-devtools": "^0.29.2",
"tailwindcss": "^3.4.1",
"vite": "^5.4.11",
"vite-plugin-solid": "^2.8.2"
"vite-plugin-solid": "^2.11.6"
},
"dependencies": {
"solid-js": "^1.8.18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.4.5",
"vinxi": "^0.4.0",
"vite": "^5.4.10",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid": "^2.11.6",
"vitest": "^1.5.0"
},
"overrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.4.5",
"vinxi": "^0.4.0",
"vite": "^5.4.11",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid": "^2.11.6",
"vitest": "^1.5.0"
},
"overrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.4.5",
"vinxi": "^0.4.0",
"vite": "^5.4.11",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid": "^2.11.6",
"vitest": "^1.5.0"
},
"overrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.4.5",
"vinxi": "^0.4.0",
"vite": "^5.4.11",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid": "^2.11.6",
"vitest": "^1.5.0"
},
"overrides": {
Expand Down
16 changes: 16 additions & 0 deletions dev-packages/node-integration-tests/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,21 @@ export default defineConfig({
},
include: ['./**/test.ts'],
testTimeout: 15000,
// Ensure we can see debug output when DEBUG=true
...(process.env.DEBUG
? {
disableConsoleIntercept: true,
silent: false,
}
: {}),
// By default Vitest uses child processes to run tests but all our tests
// already run in their own processes. We use threads instead because the
// overhead is significantly less.
pool: 'threads',
reporters: process.env.DEBUG
? ['default', { summary: false }]
: process.env.GITHUB_ACTIONS
? ['dot', 'github-actions']
: ['verbose'],
},
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@size-limit/webpack": "~11.1.6",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.19.1",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/coverage-v8": "^3.2.4",
"deepmerge": "^4.2.2",
"downlevel-dts": "~0.11.0",
"es-check": "^7.2.1",
Expand All @@ -134,7 +134,7 @@
"sucrase": "^3.35.0",
"ts-node": "10.9.1",
"typescript": "~5.0.0",
"vitest": "^2.1.8",
"vitest": "^3.2.4",
"yalc": "^1.0.0-pre.53",
"yarn-deduplicate": "6.0.2"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/browser/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ export default defineConfig({
...baseConfig,
test: {
...baseConfig.test,
// Vitest 3 mocks all timers which broke some tests
fakeTimers: {
toFake: ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate', 'Date'],
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ describe('createSentryHandleRequest', () => {

await handleRequest(mockRequest, 200, mockResponseHeaders, mockRouterContext, mockLoadContext);

// eslint-disable-next-line @typescript-eslint/unbound-method
expect(mockResponseHeaders.set).toHaveBeenCalledWith('Content-Type', 'text/html');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ describe('Integration | sendReplayEvent', () => {
// Retries = 3 (total tries = 4 including initial attempt)
// + last exception is max retries exceeded
expect(spyHandleException).toHaveBeenCalledTimes(5);
expect(spyHandleException).toHaveBeenLastCalledWith(new Error('Unable to send Replay - max retries exceeded'));
const expectedError = new Error('Unable to send Replay - max retries exceeded');
(expectedError as any).cause = new Error('Something bad happened');
expect(spyHandleException).toHaveBeenLastCalledWith(expectedError);

const spyHandleExceptionCall = spyHandleException.mock.calls;
expect(spyHandleExceptionCall[spyHandleExceptionCall.length - 1][0]?.cause.message).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion packages/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/user-event": "^14.5.2",
"solid-js": "^1.8.11",
"vite-plugin-solid": "^2.8.2"
"vite-plugin-solid": "^2.11.6"
},
"scripts": {
"build": "run-p build:transpile build:types",
Expand Down
2 changes: 1 addition & 1 deletion packages/solidstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@solidjs/testing-library": "0.8.5",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/user-event": "^14.5.2",
"vite-plugin-solid": "^2.8.2"
"vite-plugin-solid": "^2.11.6"
},
"scripts": {
"build": "run-p build:transpile build:types",
Expand Down
Loading
Loading