-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathssr-error-stack.ts
More file actions
34 lines (30 loc) · 1.08 KB
/
ssr-error-stack.ts
File metadata and controls
34 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { doesNotMatch, match } from 'node:assert';
import { ng } from '../../utils/process';
import { appendToFile } from '../../utils/fs';
import { ngServe, useSha } from '../../utils/project';
import { installWorkspacePackages, uninstallPackage } from '../../utils/packages';
export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
// Create Error.
await appendToFile(
'src/app/app.ts',
`
(() => {
throw new Error('something happened!');
})();
`,
);
const port = await ngServe();
const response = await fetch(`http://localhost:${port}/`);
const text = await response.text();
// The error is also sent in the browser, so we don't need to scrap the stderr.
match(
text,
/something happened.+at eval \(.+[\\/]+e2e-test[\\/]+test-project[\\/]+src[\\/]+app[\\/]+app\.ts:\d+:\d+\)/,
);
doesNotMatch(text, /vite-root/);
}