-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Describe the bug
I'm trying to write a custom runner for Svelte tests. However, I'm also running my tests in browser mode, and I noticed that my runner is not instantiated at all. If I comment out the browser configuration, my runner is instantiated correctly.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-kmmccmjy?file=vite.config.ts
Given a basic runner that throws on construction:
// customrunner.js
import { VitestTestRunner } from 'vitest/runners';
class CustomRunner extends VitestTestRunner {
constructor(config) {
throw new Error('Custom runner failed successfully!');
}
}
export default CustomRunner;And a basic config:
export default defineConfig({
test: {
runner: './customrunner.js',
// Comment out here to see the custom runner failing tests
browser: {
enabled: true,
provider: preview(), // issue is with other providers also
instances: [{ browser: 'chromium' }],
},
},
});
You can see that the tests run even though the runner should be throwing. If you comment out the browser config and run again, the runner will throw and fail the tests as expected.
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@vitest/browser-preview: latest => 4.0.18
@vitest/ui: latest => 4.0.18
vite: latest => 7.3.1
vitest: latest => 4.0.18Used 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.