Skip to content

Commit 0bc1727

Browse files
committed
test(@angular/cli): add E2E test for file replacement watching
1 parent 14925bd commit 0bc1727

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { getGlobalVariable } from '../../utils/env';
2+
import { appendToFile } from '../../utils/fs';
3+
import {
4+
execAndWaitForOutputToMatch,
5+
killAllProcesses,
6+
waitForAnyProcessOutputToMatch,
7+
} from '../../utils/process';
8+
9+
const webpackGoodRegEx = /: Compiled successfully./;
10+
11+
export default async function() {
12+
if (process.platform.startsWith('win')) {
13+
return;
14+
}
15+
16+
let error;
17+
try {
18+
await execAndWaitForOutputToMatch('ng', ['serve', '--prod'], webpackGoodRegEx);
19+
20+
// Should trigger a rebuild.
21+
await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`);
22+
await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 30000);
23+
} catch (e) {
24+
error = e;
25+
}
26+
27+
killAllProcesses();
28+
if (error) {
29+
throw error;
30+
}
31+
}

0 commit comments

Comments
 (0)