vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Warnings from vitest on missing Sourcemap's from source files

Open jamesg1 opened this issue 6 months ago • 1 comments
trafficstars

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

jamesg1 avatar May 14 '25 04:05 jamesg1

Any updates for this? I want to hide those warnings.

ChangeHow avatar Jun 09 '25 03:06 ChangeHow

@jamesg1 or anyone else, can you minimize the reproduction so it's easier to see what's causing this?

AriPerkkio avatar Jul 02 '25 16:07 AriPerkkio

@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.

jamesg1 avatar Jul 07 '25 22:07 jamesg1

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?

AriPerkkio avatar Jul 08 '25 05:07 AriPerkkio

I have same issue

aShelist avatar Jul 18 '25 11:07 aShelist

I have the same issue too

rushelex avatar Sep 19 '25 08:09 rushelex

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.

github-actions[bot] avatar Sep 19 '25 10:09 github-actions[bot]