vitest
vitest copied to clipboard
Warnings from vitest on missing Sourcemap's from source files
Describe the bug
When running vitest I get these warnings. Unable to seem to solve/remove them from showing up.
Sourcemap for "/Users/user/code/vite-repo/node_modules/vitest/dist/runners.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/@vitest/snapshot/dist/index.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/vitest/dist/chunks/setup-common.AQcDs321.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/.vite/deps/chunk-S2L5SCOP.js" points to missing source files
My test output from my codebase:
npx vitest run --browser.headless
RUN v3.1.3 /Users/user/code/vite-repo/
Sourcemap for "/Users/user/code/vite-repo/node_modules/node_modules/vitest/dist/runners.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/node_modules/vitest/dist/chunks/setup-common.AQcDs321.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/node_modules/@vitest/snapshot/dist/index.js" points to missing source files
Sourcemap for "/Users/user/code/vite-repo/node_modules/node_modules/.vite/deps/chunk-S2L5SCOP.js" points to missing source files
✓ chromium src/components/AuthContext.test.tsx (7 tests) 46ms
....
Test Files 17 passed (17)
Tests 50 passed (50)
Start at 14:01:22
Duration 4.87s (transform 0ms, setup 2.96s, collect 12.68s, tests 1.72s, environment 0ms, prepare 932ms)
My vitest config in vite.config.ts.
test: {
globals: true,
setupFiles: './test/setupTests.ts',
browser: {
enabled: true,
provider: 'playwright',
instances: [{ browser: 'chromium' }],
screenshotFailures: false,
},
coverage: {
provider: 'istanbul',
include: ['src/**/*.{ts,tsx}'],
exclude: ['src/components/ui', 'src/mocks'],
reporter: ['text', 'json', 'html', 'lcov', 'cobertura'],
},
},
Reproduction
Code: https://stackblitz.com/~/github.com/jamesg1/example-vitest and https://github.com/jamesg1/example-vitest - need to pull down and run as it requires playwright runners.
https://github.com/jamesg1/example-vitest
RUN v3.1.3 /Users/user/example-repo
Sourcemap for "/Users/user/example-repo/node_modules/vitest/dist/runners.js" points to missing source files
Sourcemap for "/Users/user/example-repo/node_modules/vitest/dist/chunks/setup-common.AQcDs321.js" points to missing source files
Sourcemap for "/Users/user/example-repo/node_modules/@vitest/snapshot/dist/index.js" points to missing source files
Sourcemap for "/Users/user/example-repo/node_modules/.vite/deps/chunk-S2L5SCOP.js" points to missing source files
✓ chromium src/App.test.tsx (1 test) 6ms
✓ App > renders without crashing 6ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 15:17:57
Duration 1.15s (transform 0ms, setup 38ms, collect 93ms, tests 6ms, environment 0ms, prepare 17ms)
System Info
System:
OS: macOS 15.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 874.52 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
Browsers:
Chrome: 136.0.7103.93
Safari: 18.4
npmPackages:
@vitejs/plugin-react: ^4.4.1 => 4.4.1
@vitest/browser: ^3.1.3 => 3.1.3
@vitest/coverage-istanbul: ^3.1.3 => 3.1.3
@vitest/ui: ^3.1.3 => 3.1.3
playwright: 1.51.0 => 1.51.0
vite: ^5.2.0 => 5.2.11
vitest: ^3.1.3 => 3.1.3
vitest-browser-react: ^0.1.1 => 0.1.1
Used Package Manager
npm
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [x] The provided reproduction is a minimal reproducible example of the bug.
Any updates for this? I want to hide those warnings.
@jamesg1 or anyone else, can you minimize the reproduction so it's easier to see what's causing this?
@jamesg1 or anyone else, can you minimize the reproduction so it's easier to see what's causing this?
Its within that repo I posted above.
Do you mean you pushed changes that reduces the reproduction? I don't see any recent changes in https://github.com/jamesg1/example-vitest/commits/main/.
The first thing any maintainer who wants to start fixing this issue is to minimize the reproduction into a subset of files that are needed to cause this. For example, are all of the 66 dependencies and 28 devDepdencies required for the bug? Does it still happen if you remove the setupTests.ts?
I have same issue
I have the same issue too
Hello @jamesg1. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.