Skip to content

Commit

Permalink
docs: add missing admonitions in configuration page v28 (#13920)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas committed Feb 16, 2023
1 parent a49c886 commit d8e2938
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions website/versioned_docs/version-28.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ module.exports = {

:::info

Note that if you also have specified [`rootDir`](#rootdir-string) that the resolution of this file will be relative to that root directory.
If you also have specified [`rootDir`](#rootdir-string), the resolution of this file will be relative to that root directory.

:::

Expand Down Expand Up @@ -1282,10 +1282,14 @@ Pretty foo: Object {
}
```

:::tip

To make a dependency explicit instead of implicit, you can call [`expect.addSnapshotSerializer`](ExpectAPI.md#expectaddsnapshotserializerserializer) to add a module for an individual test file instead of adding its path to `snapshotSerializers` in Jest configuration.

More about serializers API can be found [here](https://github.com/facebook/jest/tree/main/packages/pretty-format/README.md#serialize).

:::

### `testEnvironment` \[string]

Default: `"node"`
Expand Down Expand Up @@ -1393,7 +1397,7 @@ For example, in `jest-environment-jsdom`, you can override options given to [`js

Both `jest-environment-jsdom` and `jest-environment-node` allow specifying `customExportConditions`, which allow you to control which versions of a library are loaded from `exports` in `package.json`. `jest-environment-jsdom` defaults to `['browser']`. `jest-environment-node` defaults to `['node', 'node-addons']`.

These options can also be passed in a docblock, similar to `testEnvironment`. Note that it must be parseable by `JSON.parse`. Example:
These options can also be passed in a docblock, similar to `testEnvironment`. The string with options must be parseable by `JSON.parse`:

```js
/**
Expand Down Expand Up @@ -1685,7 +1689,7 @@ Default: `[]`

An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them. If a module's path matches any of the patterns in this list, it will not be automatically mocked by the module loader.

This is useful for some commonly used 'utility' modules that are almost always used as implementation details almost all the time (like underscore/lodash, etc). It's generally a best practice to keep this list as small as possible and always use explicit `jest.mock()`/`jest.unmock()` calls in individual tests. Explicit per-test setup is far easier for other readers of the test to reason about the environment the test will run in.
This is useful for some commonly used 'utility' modules that are almost always used as implementation details almost all the time (like `underscore`, `lodash`, etc). It's generally a best practice to keep this list as small as possible and always use explicit `jest.mock()`/`jest.unmock()` calls in individual tests. Explicit per-test setup is far easier for other readers of the test to reason about the environment the test will run in.

It is possible to override this setting in individual tests by explicitly calling `jest.mock()` at the top of the test file.

Expand Down

0 comments on commit d8e2938

Please sign in to comment.