Open
Description
Describe the bug
Vitest wont start on workspace open with Node v22.14.0
Reproduction
mkdir test-issue
cd test-issue
echo "22.14.0" > .nvmrc
nvm use
npm init # skip past all prompts with ENTER
npm install -D vitest typescript @types/node
add this config to vitest.config.mts
/// <reference types="vitest/config" />
import { defineConfig } from 'vitest/config';
/** @see https://vitejs.dev/config/ */
export default defineConfig({
test: {
include: ['src/**/*.test.{ts,tsx}'],
globals: true,
environment: 'jsdom',
coverage: {
include: ['src/**/*.{ts,tsx}'],
provider: 'istanbul',
reporter: ['text', 'lcov'],
},
},
});
Output
Error: Vitest failed to start:
TypeError: crypto$2.getRandomValues is not a function
at resolveConfig (file:///Users/kyle/Code/@capsule/io-ui/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Pj_jxEzN.js:54282:16)
at async _createServer (file:///Users/kyle/Code/@capsule/io-ui/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Pj_jxEzN.js:43875:18)
at async createViteServer (file:///Users/kyle/Code/@capsule/io-ui/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.bwYuoT4p.js:10149:17)
at async Module.createVitest (file:///Users/kyle/Code/@capsule/io-ui/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.bwYuoT4p.js:13130:17)
at async To (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/worker.js:21:8519)
at async e (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/worker.js:21:10149)
at r.l (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:17:5801)
at r.emit (node:events:518:28)
at Kr.Dl (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:39632)
at Kr.emit (node:events:518:28)
at Kr.dataMessage (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:17080)
at Kr.getData (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:15943)
at Kr.startLoop (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:12525)
at Kr._write (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:11809)
at writeOrBuffer (node:internal/streams/writable:572:12)
at _write (node:internal/streams/writable:501:10)
at Kr.Writable.write (node:internal/streams/writable:510:10)
at Socket.rr (/Users/kyle/.vscode/extensions/vitest.explorer-1.16.1/dist/extension.js:1:40610)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Socket.Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23)
Extension Version
1.16.1
Vitest Version
3.1.1
Validations
- Check that you are using the latest version of the extension
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.