Skip to content

Commit 5f7129c

Browse files
authored
test: Update Vitest (#16682)
This PR updates Vitest to the latest version which has much better (non-flickering) output and also adds a custom config for the Node integration tests. This custom config was mainly to override the `pool: 'threads'` option which improves performance significantly when you don't need process isolation.
1 parent 3c012d0 commit 5f7129c

File tree

14 files changed

+206
-144
lines changed

14 files changed

+206
-144
lines changed

dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"solid-devtools": "^0.29.2",
2323
"tailwindcss": "^3.4.1",
2424
"vite": "^5.4.11",
25-
"vite-plugin-solid": "^2.8.2"
25+
"vite-plugin-solid": "^2.11.6"
2626
},
2727
"dependencies": {
2828
"@solidjs/router": "^0.13.5",

dev-packages/e2e-tests/test-applications/solid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"solid-devtools": "^0.29.2",
2323
"tailwindcss": "^3.4.1",
2424
"vite": "^5.4.11",
25-
"vite-plugin-solid": "^2.8.2"
25+
"vite-plugin-solid": "^2.11.6"
2626
},
2727
"dependencies": {
2828
"solid-js": "^1.8.18",

dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"typescript": "^5.4.5",
2929
"vinxi": "^0.4.0",
3030
"vite": "^5.4.10",
31-
"vite-plugin-solid": "^2.10.2",
31+
"vite-plugin-solid": "^2.11.6",
3232
"vitest": "^1.5.0"
3333
},
3434
"overrides": {

dev-packages/e2e-tests/test-applications/solidstart-spa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"typescript": "^5.4.5",
2929
"vinxi": "^0.4.0",
3030
"vite": "^5.4.11",
31-
"vite-plugin-solid": "^2.10.2",
31+
"vite-plugin-solid": "^2.11.6",
3232
"vitest": "^1.5.0"
3333
},
3434
"overrides": {

dev-packages/e2e-tests/test-applications/solidstart-top-level-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"typescript": "^5.4.5",
2929
"vinxi": "^0.4.0",
3030
"vite": "^5.4.11",
31-
"vite-plugin-solid": "^2.10.2",
31+
"vite-plugin-solid": "^2.11.6",
3232
"vitest": "^1.5.0"
3333
},
3434
"overrides": {

dev-packages/e2e-tests/test-applications/solidstart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"typescript": "^5.4.5",
2929
"vinxi": "^0.4.0",
3030
"vite": "^5.4.11",
31-
"vite-plugin-solid": "^2.10.2",
31+
"vite-plugin-solid": "^2.11.6",
3232
"vitest": "^1.5.0"
3333
},
3434
"overrides": {

dev-packages/node-integration-tests/vite.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,21 @@ export default defineConfig({
1111
},
1212
include: ['./**/test.ts'],
1313
testTimeout: 15000,
14+
// Ensure we can see debug output when DEBUG=true
15+
...(process.env.DEBUG
16+
? {
17+
disableConsoleIntercept: true,
18+
silent: false,
19+
}
20+
: {}),
21+
// By default Vitest uses child processes to run tests but all our tests
22+
// already run in their own processes. We use threads instead because the
23+
// overhead is significantly less.
24+
pool: 'threads',
25+
reporters: process.env.DEBUG
26+
? ['default', { summary: false }]
27+
: process.env.GITHUB_ACTIONS
28+
? ['dot', 'github-actions']
29+
: ['verbose'],
1430
},
1531
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"@size-limit/webpack": "~11.1.6",
116116
"@types/jsdom": "^21.1.6",
117117
"@types/node": "^18.19.1",
118-
"@vitest/coverage-v8": "^2.1.8",
118+
"@vitest/coverage-v8": "^3.2.4",
119119
"deepmerge": "^4.2.2",
120120
"downlevel-dts": "~0.11.0",
121121
"es-check": "^7.2.1",
@@ -134,7 +134,7 @@
134134
"sucrase": "^3.35.0",
135135
"ts-node": "10.9.1",
136136
"typescript": "~5.0.0",
137-
"vitest": "^2.1.8",
137+
"vitest": "^3.2.4",
138138
"yalc": "^1.0.0-pre.53",
139139
"yarn-deduplicate": "6.0.2"
140140
},

packages/browser/vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ export default defineConfig({
55
...baseConfig,
66
test: {
77
...baseConfig.test,
8+
// Vitest 3 mocks all timers which broke some tests
9+
fakeTimers: {
10+
toFake: ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate', 'Date'],
11+
},
812
},
913
});

packages/react-router/test/server/createSentryHandleRequest.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ describe('createSentryHandleRequest', () => {
242242

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

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

packages/replay-internal/test/integration/sendReplayEvent.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@ describe('Integration | sendReplayEvent', () => {
397397
// Retries = 3 (total tries = 4 including initial attempt)
398398
// + last exception is max retries exceeded
399399
expect(spyHandleException).toHaveBeenCalledTimes(5);
400-
expect(spyHandleException).toHaveBeenLastCalledWith(new Error('Unable to send Replay - max retries exceeded'));
400+
const expectedError = new Error('Unable to send Replay - max retries exceeded');
401+
(expectedError as any).cause = new Error('Something bad happened');
402+
expect(spyHandleException).toHaveBeenLastCalledWith(expectedError);
401403

402404
const spyHandleExceptionCall = spyHandleException.mock.calls;
403405
expect(spyHandleExceptionCall[spyHandleExceptionCall.length - 1][0]?.cause.message).toEqual(

packages/solid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@testing-library/jest-dom": "^6.4.5",
6363
"@testing-library/user-event": "^14.5.2",
6464
"solid-js": "^1.8.11",
65-
"vite-plugin-solid": "^2.8.2"
65+
"vite-plugin-solid": "^2.11.6"
6666
},
6767
"scripts": {
6868
"build": "run-p build:transpile build:types",

packages/solidstart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@solidjs/testing-library": "0.8.5",
7878
"@testing-library/jest-dom": "^6.4.5",
7979
"@testing-library/user-event": "^14.5.2",
80-
"vite-plugin-solid": "^2.8.2"
80+
"vite-plugin-solid": "^2.11.6"
8181
},
8282
"scripts": {
8383
"build": "run-p build:transpile build:types",

0 commit comments

Comments
 (0)