Skip to content

Commit

Permalink
refactor(utils): improve ngcc-jest-processor error message (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Aug 17, 2021
1 parent a4251dd commit b006f86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/ngcc-jest-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { dirname, join } from 'path';

const IGNORE_ARGS = ['--clearCache', '--help', '--init', '--listTests', '--showConfig'];
const nodeModuleDirPath = findNodeModulesDirectory(process.cwd());
const canRunNgcc =
!process.argv.find((arg) => IGNORE_ARGS.includes(arg)) && existsSync(join(nodeModuleDirPath, '@angular', 'core'));
const angularCorePkgPath = join(nodeModuleDirPath, '@angular', 'core');
const canRunNgcc = !process.argv.find((arg) => IGNORE_ARGS.includes(arg)) && existsSync(angularCorePkgPath);
function findNodeModulesDirectory(startPoint: string): string {
let current = startPoint;
while (dirname(current) !== current) {
Expand Down Expand Up @@ -60,6 +60,6 @@ if (canRunNgcc) {
}
} else {
throw new Error(
`Cannot locate the '@angular/core' directory. Please make sure you are running 'ngcc-jest-processor.js' from root level of your project`,
`Cannot locate the '@angular/core' directory, resolved as ${angularCorePkgPath}. Please make sure you are running 'ngcc-jest-processor.js' from root level of your project`,
);
}

0 comments on commit b006f86

Please sign in to comment.