Skip to content

Commit

Permalink
docs: add notes about migrating replaceProperty (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteryven committed Mar 7, 2023
1 parent cdfdb20 commit 26265b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/guide/migration.md
Expand Up @@ -48,6 +48,8 @@ Jest exports various [`jasmine`](https://jasmine.github.io/) globals (such as `j

Just like Jest, Vitest sets `NODE_ENV` to `test`, if it wasn't set before. Vitest also has a counterpart for `JEST_WORKER_ID` called `VITEST_POOL_ID` (always less than or equal to `maxThreads`), so if you rely on it, don't forget to rename it. Vitest also exposes `VITEST_WORKER_ID` which is a unique ID of a running worker - this number is not affected by `maxThreads`, and will increase with each created worker.

If you want to modify the envs, you will use [replaceProperty API](https://jestjs.io/docs/jest-object#jestreplacepropertyobject-propertykey-value) in Jest, you can use [vi.stubEnv](https://vitest.dev/api/vi.html#vi-stubenv) to do it also in Vitest.

**Done Callback**

From Vitest v0.10.0, the callback style of declaring tests is deprecated. You can rewrite them to use `async`/`await` functions, or use Promise to mimic the callback style.
Expand Down

0 comments on commit 26265b3

Please sign in to comment.