Skip to content

Commit

Permalink
test: mess process
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed Feb 12, 2022
1 parent 6044f42 commit 1538626
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vitest/src/runtime/entry.ts
Expand Up @@ -17,7 +17,10 @@ export async function run(files: string[], config: ResolvedConfig): Promise<void
__vitest_worker__.filepath = file

await withEnv(env as BuiltinEnvironment, config.environmentOptions || {}, async() => {
const cacheProcess = process
await startTests([file], config)
// eslint-disable-next-line no-global-assign
process = cacheProcess
})

__vitest_worker__.filepath = undefined
Expand Down
6 changes: 6 additions & 0 deletions test/core/test/basic.test.ts
Expand Up @@ -2,6 +2,12 @@ import { assert, expect, it, suite, test } from 'vitest'
import { two } from '../src/submodule'
import { timeout } from '../src/timeout'

test('mess process', () => {
// eslint-disable-next-line no-global-assign
process = 1 as any
expect(process).toBe(1)
})

test('Math.sqrt()', async() => {
assert.equal(Math.sqrt(4), two)
assert.equal(Math.sqrt(2), Math.SQRT2)
Expand Down

0 comments on commit 1538626

Please sign in to comment.