-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow running
ngcc
with specific tsconfig
path
- Loading branch information
anh.pham
committed
Apr 25, 2022
1 parent
7950b5c
commit 09c1aa9
Showing
4 changed files
with
79 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ngcc-jest-processor should execute @angular/compiler-cli ngcc with tsconfig path foo 1`] = ` | ||
Array [ | ||
"/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js", | ||
"--source", | ||
"/node_modules/", | ||
"--properties", | ||
"es2015", | ||
"main", | ||
"--first-only", | ||
"false", | ||
"--async", | ||
"--tsconfig", | ||
"foo", | ||
] | ||
`; | ||
|
||
exports[`ngcc-jest-processor should execute @angular/compiler-cli ngcc with tsconfig path undefined 1`] = ` | ||
Array [ | ||
"/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js", | ||
"--source", | ||
"/node_modules/", | ||
"--properties", | ||
"es2015", | ||
"main", | ||
"--first-only", | ||
"false", | ||
"--async", | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import childProcess from 'child_process'; | ||
|
||
import { runNgccJestProcessor } from './ngcc-jest-processor'; | ||
|
||
describe('ngcc-jest-processor', () => { | ||
test.each(['foo', undefined])('should execute @angular/compiler-cli ngcc with tsconfig path %s', (tsconfigPath) => { | ||
const mockedSpawnSync = (childProcess.spawnSync = jest.fn().mockReturnValueOnce({ | ||
status: 0, | ||
})); | ||
|
||
runNgccJestProcessor(tsconfigPath); | ||
|
||
expect(childProcess.spawnSync).toHaveBeenCalled(); | ||
expect(mockedSpawnSync.mock.calls[0][0]).toBe(process.execPath); | ||
const ngccArgs = (mockedSpawnSync.mock.calls[0][1] as string[]).map((arg) => arg.replace(process.cwd(), '')); | ||
expect(ngccArgs).toMatchSnapshot(); | ||
|
||
jest.restoreAllMocks(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters