[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix: process sourcemaps for stack traces from `globalSetup` files (#8534)

authored by

Vladimir and committed by
GitHub
(Sep 6, 2025, 10:07 AM +0800) 8978a23b 969456b4

+19 -6
+3 -1
packages/utils/src/source-map.ts
··· 178 178 : resolve(file) 179 179 180 180 if (method) { 181 - method = method.replace(/__vite_ssr_import_\d+__\./g, '') 181 + method = method 182 + .replace(/__vite_ssr_import_\d+__\./g, '') 183 + .replace(/(Object\.)?__vite_ssr_export_default__\s?/g, '') 182 184 } 183 185 184 186 return {
+2
test/cli/test/global-setup-fail.test.ts
··· 14 14 .find(i => i.includes('Error: ')) 15 15 ?.trim() 16 16 expect(msg).toBe('Error: error') 17 + expect(stderr).not.toContain('__vite_ssr_export_default__') 18 + expect(stderr).toContain('globalSetup/error.ts:6:9') 17 19 }, 50000)
+2
test/coverage-test/test/run-dynamic-coverage.test.ts
··· 7 7 // Run a minimal suite where coverage starts disabled, then enable it and rerun. 8 8 const { ctx } = await runVitest({ 9 9 include: ['fixtures/test/math.test.ts'], 10 + watch: true, 10 11 coverage: { 11 12 // start disabled and turn on dynamically 12 13 enabled: false, ··· 28 29 test('disableCoverage() stops collecting coverage going forward', async () => { 29 30 const { ctx } = await runVitest({ 30 31 include: ['fixtures/test/math.test.ts'], 32 + watch: true, 31 33 coverage: { 32 34 enabled: true, 33 35 reporter: 'json',
+4
packages/vitest/src/node/project.ts
··· 512 512 this.clearTmpDir(), 513 513 ].filter(Boolean), 514 514 ).then(() => { 515 + if (!this.runner.isClosed()) { 516 + return this.runner.close() 517 + } 518 + }).then(() => { 515 519 this._provided = {} as any 516 520 this._vite = undefined 517 521 })
+1 -1
test/cli/fixtures/global-setup-fail/vitest.config.ts
··· 5 5 test: { 6 6 globals: true, 7 7 globalSetup: [ 8 - resolve(import.meta.dirname, './globalSetup/error.js'), 8 + resolve(import.meta.dirname, './globalSetup/error.ts'), 9 9 ], 10 10 }, 11 11 })
-1
packages/vitest/src/node/environments/serverRunner.ts
··· 19 19 super( 20 20 { 21 21 hmr: false, 22 - sourcemapInterceptor: 'node', 23 22 transport: { 24 23 async invoke(event) { 25 24 if (event.type !== 'custom') {
-3
test/cli/fixtures/global-setup-fail/globalSetup/error.js
··· 1 - export default function () { 2 - throw new Error('error') 3 - }
+7
test/cli/fixtures/global-setup-fail/globalSetup/error.ts
··· 1 + interface _Test { 2 + method: () => void 3 + } 4 + 5 + export default function () { 6 + throw new Error('error') 7 + }