-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
package.json
{
"name": "vitest_project",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "vitest"
},
"devDependencies": {
"@vitest/browser-playwright": "4.0.15",
"@vitest/ui": "4.0.15",
"vitest": "4.0.15"
}
}
vitest.config.js
import { defineConfig } from 'vitest/config';
import { playwright } from '@vitest/browser-playwright';
export default defineConfig({
test: {
browser: {
enabled: true,
headless: true,
provider: playwright(),
instances: [
{
browser: 'chromium',
headless: true
}
]
},
reporters: [
'html'
],
include: ['tests/**/*.test.{js,mjs,cjs,ts}']
}
});
tests/example.test.js
import { describe, it, expect } from 'vitest';
describe('basic', () => {
it('1 equals 1', () => {
expect(1).toBe(1);
});
});
When running npm test I get the following error
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Cannot find environment for /home/dezsiszabi/projects/vitest_project/tests/example.test.js
❯ getModuleGraph node_modules/@vitest/ui/dist/reporter.js:487:9
❯ node_modules/@vitest/ui/dist/reporter.js:594:59
❯ HTMLReporter.onTestRunEnd node_modules/@vitest/ui/dist/reporter.js:588:35
❯ node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:12876:56
❯ Vitest.report node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:12876:36
❯ TestRun.end node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:11716:21
❯ node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:12529:26
❯ node_modules/vitest/dist/chunks/cli-api.C7sYjHmQ.js:12539:11
[email protected] works fine.
First noticed while using vitest with angular and reported here (angular/angular-cli#32054), but I can reproduce this issue outside Angular so it seems like a vitest issue.
Reproduction
See description.
System Info
System:
OS: Linux 5.15 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
Memory: 12.69 GB / 15.58 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 24.11.1 - /usr/bin/node
Yarn: 1.22.22 - /mnt/c/Users/dezsi/AppData/Roaming/npm/yarn
npm: 11.6.2 - /usr/bin/npm
pnpm: 10.24.0 - /mnt/c/Users/dezsi/AppData/Roaming/npm/pnpm
npmPackages:
@vitest/browser-playwright: 4.0.15 => 4.0.15
@vitest/ui: 4.0.15 => 4.0.15
vitest: 4.0.15 => 4.0.15Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- 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.
Dameck
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)