-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vitest): show rollup error details as test error (#6686)
- Loading branch information
Showing
6 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "vite/no-such-export" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@vitejs/no-such-package' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
// pnpm -C test/config test -- --root fixtures/rollup-error --environment happy-dom | ||
// pnpm -C test/config test -- --root fixtures/rollup-error --environment node | ||
|
||
export default defineConfig({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect, test } from 'vitest' | ||
import { runVitest } from '../../test-utils' | ||
|
||
test('rollup error node', async () => { | ||
const { stdout } = await runVitest({ | ||
root: './fixtures/rollup-error', | ||
environment: 'node', | ||
reporters: ['junit'], | ||
}) | ||
expect(stdout).toContain(`Error: Missing "./no-such-export" specifier in "vite" package`) | ||
expect(stdout).toContain(`Plugin: vite:import-analysis`) | ||
expect(stdout).toContain(`Error: Failed to load url @vitejs/no-such-package`) | ||
}) | ||
|
||
test('rollup error web', async () => { | ||
const { stdout } = await runVitest({ | ||
root: './fixtures/rollup-error', | ||
environment: 'jsdom', | ||
reporters: ['junit'], | ||
}) | ||
expect(stdout).toContain(`Error: Missing "./no-such-export" specifier in "vite" package`) | ||
expect(stdout).toContain(`Plugin: vite:import-analysis`) | ||
expect(stdout).toContain(`Error: Failed to resolve import "@vitejs/no-such-package" from "fixtures/rollup-error/not-found-package.test.ts". Does the file exist?`) | ||
}) |