Skip to content
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
4 changes: 3 additions & 1 deletion packages/utils/src/source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ export function parseSingleV8Stack(raw: string): ParsedStack | null {
: resolve(file)

if (method) {
method = method.replace(/__vite_ssr_import_\d+__\./g, '')
method = method
.replace(/__vite_ssr_import_\d+__\./g, '')
.replace(/(Object\.)?__vite_ssr_export_default__\s?/g, '')
}

return {
Expand Down
1 change: 0 additions & 1 deletion packages/vitest/src/node/environments/serverRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class ServerModuleRunner extends ModuleRunner {
super(
{
hmr: false,
sourcemapInterceptor: 'node',
transport: {
async invoke(event) {
if (event.type !== 'custom') {
Expand Down
4 changes: 4 additions & 0 deletions packages/vitest/src/node/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ export class TestProject {
this.clearTmpDir(),
].filter(Boolean),
).then(() => {
if (!this.runner.isClosed()) {
return this.runner.close()
}
}).then(() => {
this._provided = {} as any
this._vite = undefined
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
interface _Test {
method: () => void
}

export default function () {
throw new Error('error')
}
2 changes: 1 addition & 1 deletion test/cli/fixtures/global-setup-fail/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
test: {
globals: true,
globalSetup: [
resolve(import.meta.dirname, './globalSetup/error.js'),
resolve(import.meta.dirname, './globalSetup/error.ts'),
],
},
})
2 changes: 2 additions & 0 deletions test/cli/test/global-setup-fail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ it('should fail', async () => {
.find(i => i.includes('Error: '))
?.trim()
expect(msg).toBe('Error: error')
expect(stderr).not.toContain('__vite_ssr_export_default__')
expect(stderr).toContain('globalSetup/error.ts:6:9')
}, 50000)
2 changes: 2 additions & 0 deletions test/coverage-test/test/run-dynamic-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test('enableCoverage() collects coverage after being called', async () => {
// Run a minimal suite where coverage starts disabled, then enable it and rerun.
const { ctx } = await runVitest({
include: ['fixtures/test/math.test.ts'],
watch: true,
coverage: {
// start disabled and turn on dynamically
enabled: false,
Expand All @@ -28,6 +29,7 @@ test('enableCoverage() collects coverage after being called', async () => {
test('disableCoverage() stops collecting coverage going forward', async () => {
const { ctx } = await runVitest({
include: ['fixtures/test/math.test.ts'],
watch: true,
coverage: {
enabled: true,
reporter: 'json',
Expand Down
Loading