Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6a3b55

Browse files
clydinalan-agius4
authored andcommitted
test(@angular/build): remove color codes before assert in vitest snapshot E2E
1 parent 2037b91 commit e6a3b55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/legacy-cli/e2e/tests/vitest/snapshot.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ng } from '../../utils/process';
22
import { appendToFile, replaceInFile, readFile } from '../../utils/fs';
33
import { applyVitestBuilder } from '../../utils/vitest';
44
import assert from 'node:assert/strict';
5+
import { stripVTControlCharacters } from 'node:util';
56

67
export default async function () {
78
// Set up the test project to use the vitest runner
@@ -28,7 +29,7 @@ export default async function () {
2829
// First run: create snapshots
2930
const { stdout: firstRunStdout } = await ng('test');
3031
assert.match(
31-
firstRunStdout,
32+
stripVTControlCharacters(firstRunStdout),
3233
/Snapshots\s+2 written/,
3334
'Snapshots were not written on the first run.',
3435
);
@@ -58,7 +59,7 @@ export default async function () {
5859
() => ng('test'),
5960
(err: any) => {
6061
assert.match(
61-
err.toString(),
62+
stripVTControlCharacters(err.toString()),
6263
/Snapshots\s+2 failed/,
6364
'Expected snapshot mismatch error, but a different error occurred.',
6465
);

0 commit comments

Comments
 (0)