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 f486310
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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.
7 changes: 6 additions & 1 deletion packages/jest-resolve/src/defaultResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,19 @@ 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;
}
}
// eslint-disable-next-line @typescript-eslint/no-throw-literal
throw lastError!;

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

0 comments on commit f486310

Please sign in to comment.