Skip to content

Commit bed5151

Browse files
committed
test(@angular-devkit/build-angular): add basic serve e2e tests
1 parent 48e5fd1 commit bed5151

File tree

1 file changed

+26
-0
lines changed
  • tests/legacy-cli/e2e/tests/basic

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { request } from '../../utils/http';
2+
import { killAllProcesses } from '../../utils/process';
3+
import { ngServe } from '../../utils/project';
4+
5+
export default async function () {
6+
try {
7+
// Serve works without HMR
8+
await ngServe('--no-hmr');
9+
await verifyResponse();
10+
killAllProcesses();
11+
12+
// Serve works with HMR
13+
await ngServe('--hmr');
14+
await verifyResponse();
15+
} finally {
16+
killAllProcesses();
17+
}
18+
}
19+
20+
async function verifyResponse(): Promise<void> {
21+
const response = await request('http://localhost:4200/');
22+
23+
if (!/<app-root><\/app-root>/.test(response)) {
24+
throw new Error('Response does not match expected value.');
25+
}
26+
}

0 commit comments

Comments
 (0)