diff --git a/packages/vitest/src/runtime/entry.ts b/packages/vitest/src/runtime/entry.ts index cad96f36d89d..93a526963e9a 100644 --- a/packages/vitest/src/runtime/entry.ts +++ b/packages/vitest/src/runtime/entry.ts @@ -17,7 +17,10 @@ export async function run(files: string[], config: ResolvedConfig): Promise { + const cacheProcess = process await startTests([file], config) + // eslint-disable-next-line no-global-assign + process = cacheProcess }) __vitest_worker__.filepath = undefined diff --git a/test/core/test/basic.test.ts b/test/core/test/basic.test.ts index b646ce3220e4..dcc726b00286 100644 --- a/test/core/test/basic.test.ts +++ b/test/core/test/basic.test.ts @@ -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)