mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
23 lines
602 B
TypeScript
23 lines
602 B
TypeScript
import { 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')
|
|
})
|