-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathbrowser-playwright.ts
More file actions
37 lines (31 loc) · 1 KB
/
browser-playwright.ts
File metadata and controls
37 lines (31 loc) · 1 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
35
36
37
import assert from 'node:assert/strict';
import { applyVitestBuilder } from '../../utils/vitest';
import { ng } from '../../utils/process';
import { installPackage } from '../../utils/packages';
import { writeFile } from '../../utils/fs';
import { updateJsonFile } from '../../utils/project';
export default async function (): Promise<void> {
await applyVitestBuilder();
await installPackage('playwright@1');
await installPackage('@vitest/browser-playwright@4');
await ng('generate', 'component', 'my-comp');
await writeFile(
'src/setup1.ts',
`
import { getTestBed } from '@angular/core/testing';
getTestBed().configureTestingModule({});
`,
);
await updateJsonFile('tsconfig.spec.json', (json) => {
json.include = [...(json.include || []), 'src/setup1.ts'];
});
const { stdout } = await ng(
'test',
'--no-watch',
'--browsers',
'chromiumHeadless',
'--setup-files',
'src/setup1.ts',
);
assert.match(stdout, /2 passed/, 'Expected 2 tests to pass.');
}