You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
## main
2
2
3
+
### Features
4
+
5
+
-`[jest-resolver]` Implement the `defaultAsyncResolver` ([#15679](https://github.com/jestjs/jest/pull/15679))
6
+
3
7
### Chore & Maintenance
4
8
5
-
-`[*]` Remove and deprecate `jest-repl` package ([15673](https://github.com/jestjs/jest/pull/15673))
9
+
-`[*]` Remove and deprecate `jest-repl` package ([#15673](https://github.com/jestjs/jest/pull/15673))
6
10
7
11
## 30.0.0
8
12
@@ -120,6 +124,7 @@
120
124
-`[*]`[**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348), [#14550](https://github.com/jestjs/jest/pull/14550) & [#14661](https://github.com/jestjs/jest/pull/14661))
121
125
-`[jest-haste-map]` Only spawn one process to check for `watchman` installation ([#14826](https://github.com/jestjs/jest/pull/14826))
122
126
-`[jest-runner]` Better cleanup `source-map-support` after test to resolve (minor) memory leak ([#15233](https://github.com/jestjs/jest/pull/15233))
127
+
-`[jest-resolver]` Migrate `resolve` and `resolve.exports` to `unrs-resolver` ([#15619](https://github.com/jestjs/jest/pull/15619))
123
128
-`[jest-circus, jest-environment-node, jest-repl, jest-runner, jest-util]` Cleanup global variables on environment teardown to reduce memory leaks ([#15215](https://github.com/jestjs/jest/pull/15215) & [#15636](https://github.com/jestjs/jest/pull/15636) & [#15643](https://github.com/jestjs/jest/pull/15643))
/** List of file extensions to search in order. */
1480
1485
extensions?:Array<string>;
1481
1486
/** List of directory names to be looked up for modules recursively. */
@@ -1491,6 +1496,8 @@ type ResolverOptions = {
1491
1496
1492
1497
The `defaultResolver` passed as an option is the Jest default resolver which might be useful when you write your custom one. It takes the same arguments as your custom synchronous one, e.g. `(path, options)` and returns a string or throws.
1493
1498
1499
+
Similarly, the `defaultAsyncResolver` is the default async resolver which takes the same arguments and returns a promise that resolves with a string or rejects with an error.
1500
+
1494
1501
:::
1495
1502
1496
1503
For example, if you want to respect Browserify's [`"browser"` field](https://github.com/browserify/browserify-handbook/blob/master/readme.markdown#browser-field), you can use the following resolver:
@@ -1522,25 +1529,6 @@ const config: Config = {
1522
1529
exportdefaultconfig;
1523
1530
```
1524
1531
1525
-
By combining `defaultResolver` and `packageFilter` we can implement a `package.json` "pre-processor" that allows us to change how the default resolver will resolve modules. For example, imagine we want to use the field `"module"` if it is present, otherwise fallback to `"main"`:
1526
-
1527
-
```js
1528
-
module.exports= (path, options) => {
1529
-
// Call the defaultResolver, so we leverage its cache, error handling, etc.
1530
-
returnoptions.defaultResolver(path, {
1531
-
...options,
1532
-
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
1533
-
packageFilter:pkg=> {
1534
-
return {
1535
-
...pkg,
1536
-
// Alter the value of `main` before resolving the package
0 commit comments