Skip to content

Commit

Permalink
fix: rethrow last error
Browse files Browse the repository at this point in the history
Updated changelog and removed copy.mjs
  • Loading branch information
unional committed Jan 3, 2023
1 parent fd3c6ed commit da9dae8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -3,7 +3,7 @@
### Features

- `[jest-haste-map]` ignore Sapling vcs directories (`.sl/`) ([#13674](https://github.com/facebook/jest/pull/13674))
- `[jest-resolve]` Support subpath imports ([#13705](https://github.com/facebook/jest/pull/13705))
- `[jest-resolve]` Support subpath imports ([#13705](https://github.com/facebook/jest/pull/13705), [#13723](https://github.com/facebook/jest/pull/13723))
- `[jest-runtime]` Add `jest.isolateModulesAsync` for scoped module initialization of asynchronous functions ([#13680](https://github.com/facebook/jest/pull/13680))
- `[jest-test-result]` Added `skipped` and `focused` status to `FormattedTestResult` ([#13700](https://github.com/facebook/jest/pull/13700))

Expand Down
Empty file removed copy.mjs
Empty file.
6 changes: 5 additions & 1 deletion packages/jest-resolve/src/defaultResolver.ts
Expand Up @@ -164,14 +164,18 @@ function resolveByPathInModule(

const resolvedValues = Array.isArray(resolved) ? resolved : [resolved];

let lastError: Error;
for (const resolved of resolvedValues) {
const resolvedPath = resolveByPath(resolved);

try {
return resolveSync(resolvedPath, options);
} catch (e) {
} catch (e: any) {
lastError = e;
continue;
}
}
throw lastError!;

function resolveByPath(resolved: string) {
if (resolved.startsWith('.')) {
Expand Down

0 comments on commit da9dae8

Please sign in to comment.