Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
590 B · 20 lines
TypeScript
123456789101112131415161718192021import { expect, it } from 'vitest'
declare global { const testValue: string}
const custom = it.extend({ providedConfigValue: ['default value', { injected: true }],})
custom('provided config value is injected', ({ providedConfigValue }) => { expect(providedConfigValue).toBe( // happy-dom provides the value in the workspace config expect.getState().environment === 'node' ? 'default value' : 'actual config value', )})
it('the same file works with different projects', () => { expect(testValue).toBe(expect.getState().environment === 'node' ? 'node' : 'jsdom')})