Skip to content

Commit 3d9947a

Browse files
committed
fixup! refactor: update to angular v13 with APF v13 output
1 parent 5df07f1 commit 3d9947a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

server/src/tests/ngcc_spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import * as child_process from 'child_process';
1010
import {EventEmitter} from 'events';
1111
import {join, resolve} from 'path';
12+
import {interval, Subject} from 'rxjs';
13+
import {takeUntil} from 'rxjs/operators';
1214

1315
import {resolveAndRunNgcc} from '../ngcc';
1416

@@ -17,13 +19,22 @@ const WORKSPACE_ROOT = join(PACKAGE_ROOT, 'integration', 'workspace');
1719
const PROJECT = join(WORKSPACE_ROOT, 'projects', 'demo');
1820

1921
describe('resolveAndRunNgcc', () => {
22+
const afterEach$ = new Subject<void>();
23+
afterEach(() => {
24+
afterEach$.next();
25+
});
26+
2027
it('runs ngcc from node_modules where ngcc is resolved to', async () => {
2128
const fakeChild = new EventEmitter();
2229
const spy = spyOn(child_process, 'fork').and.returnValue(fakeChild as any);
2330
// Note that tsconfig.json is in the project directory
2431
const tsconfig = join(PROJECT, 'tsconfig.json');
32+
// Because resolveNgcc is async, we need to periodically emit `close` from the child since
33+
// `resolveAndRunNgcc` subscribes after the async resolveNgcc.
34+
interval(500).pipe(takeUntil(afterEach$)).subscribe(() => {
35+
fakeChild.emit('close', 0 /* exit code */);
36+
});
2537
const promise = resolveAndRunNgcc(tsconfig, {report() {}});
26-
fakeChild.emit('close', 0 /* exit code */);
2738
await expectAsync(promise).toBeResolved();
2839
expect(spy.calls.count()).toBe(1);
2940
// First arg is the ngcc binary, second arg is program arguments, third

0 commit comments

Comments
 (0)