-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
feat: contextp3-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
There's no way to override fixtures that are used by auto fixtures. Code below keeps throwing Config missing. Note that this condition also requires setupFile to be there.
import { test as baseTest, describe } from 'vitest';
const test = baseTest
.extend('config', (): undefined | {port: number, host: string} => undefined)
.extend('server', { auto: true }, ({ config }) => {
console.log({config})
if (!config) {
throw new Error('Missing config');
}
return `http://${config.host}:${config.port}`;
});
describe('production environment', () => {
test.override('config', { port: 8080, host: 'api.example.com' });
test('uses production config', () => {});
});import { beforeEach } from 'vitest';
beforeEach(({ task }) => {
console.log(task.id)
});Repro uses new builder pattern, but same issue happens with old pattern too.
Reproduction
https://stackblitz.com/~/edit/vitest-dev-vitest-ildnktb3?file=basic.test.ts&initialPath=/__vitest__/
System Info
Stackblitz, `vitest@4.1.0-beta.5`Used 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: contextp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)