Skip to content

Commit b006f86

Browse files
authored
refactor(utils): improve ngcc-jest-processor error message (#988)
1 parent a4251dd commit b006f86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/ngcc-jest-processor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { dirname, join } from 'path';
88

99
const IGNORE_ARGS = ['--clearCache', '--help', '--init', '--listTests', '--showConfig'];
1010
const nodeModuleDirPath = findNodeModulesDirectory(process.cwd());
11-
const canRunNgcc =
12-
!process.argv.find((arg) => IGNORE_ARGS.includes(arg)) && existsSync(join(nodeModuleDirPath, '@angular', 'core'));
11+
const angularCorePkgPath = join(nodeModuleDirPath, '@angular', 'core');
12+
const canRunNgcc = !process.argv.find((arg) => IGNORE_ARGS.includes(arg)) && existsSync(angularCorePkgPath);
1313
function findNodeModulesDirectory(startPoint: string): string {
1414
let current = startPoint;
1515
while (dirname(current) !== current) {
@@ -60,6 +60,6 @@ if (canRunNgcc) {
6060
}
6161
} else {
6262
throw new Error(
63-
`Cannot locate the '@angular/core' directory. Please make sure you are running 'ngcc-jest-processor.js' from root level of your project`,
63+
`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`,
6464
);
6565
}

0 commit comments

Comments
 (0)