Skip to content

Commit da9dae8

Browse files
committed
fix: rethrow last error
Updated changelog and removed copy.mjs
1 parent fd3c6ed commit da9dae8

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Features
44

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

copy.mjs

Whitespace-only changes.

packages/jest-resolve/src/defaultResolver.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,18 @@ function resolveByPathInModule(
164164

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

167+
let lastError: Error;
167168
for (const resolved of resolvedValues) {
168169
const resolvedPath = resolveByPath(resolved);
170+
169171
try {
170172
return resolveSync(resolvedPath, options);
171-
} catch (e) {
173+
} catch (e: any) {
174+
lastError = e;
172175
continue;
173176
}
174177
}
178+
throw lastError!;
175179

176180
function resolveByPath(resolved: string) {
177181
if (resolved.startsWith('.')) {

0 commit comments

Comments
 (0)