MCPcopy Index your code
hub / github.com/angular/angular-cli / expectFileToMatch

Function expectFileToMatch

tests/e2e/utils/fs.ts:108–118  ·  view source on GitHub ↗
(fileName: string, regEx: RegExp | string)

Source from the content-addressed store, hash-verified

106}
107
108export async function expectFileToMatch(fileName: string, regEx: RegExp | string): Promise<void> {
109 const content = await readFile(fileName);
110
111 const found = typeof regEx === 'string' ? content.includes(regEx) : content.match(regEx);
112
113 if (!found) {
114 throw new Error(
115 `File "${fileName}" did not contain "${regEx}"...\nContent:\n${content}\n------`,
116 );
117 }
118}
119
120export async function getFileSize(fileName: string) {
121 const stats = await fs.stat(fileName);

Calls 2

readFileFunction · 0.70
matchMethod · 0.45

Tested by

no test coverage detected