Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set MODULE_NOT_FOUND code when module is not resolved from paths #8487

Merged
merged 13 commits into from
Nov 9, 2019
4 changes: 3 additions & 1 deletion packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,13 @@ class Runtime {
return module;
}
}
throw new Error(
const moduleError: Error & {code?: string} = new Error(
`Cannot resolve module '${moduleName}' from paths ['${paths.join(
"', '",
)}'] from ${from}`,
);
moduleError.code = 'MODULE_NOT_FOUND';
throw moduleError;
}
try {
return this._resolveModule(from, moduleName);
Expand Down