1- import { ng } from '../../utils/process' ;
1+ import { ng , noSilentNg } from '../../utils/process' ;
22import { appendToFile , replaceInFile , readFile } from '../../utils/fs' ;
33import { applyVitestBuilder } from '../../utils/vitest' ;
44import assert from 'node:assert/strict' ;
55import { stripVTControlCharacters } from 'node:util' ;
6+ import { setTimeout } from 'node:timers/promises' ;
67
78export default async function ( ) {
89 // Set up the test project to use the vitest runner
@@ -27,27 +28,28 @@ export default async function () {
2728 ) ;
2829
2930 // First run: create snapshots
30- const { stdout : firstRunStdout } = await ng ( 'test' ) ;
31+ const { stdout : firstRunStdout } = await noSilentNg ( 'test' ) ;
3132 assert . match (
3233 stripVTControlCharacters ( firstRunStdout ) ,
3334 / S n a p s h o t s \s + 2 w r i t t e n / ,
3435 'Snapshots were not written on the first run.' ,
3536 ) ;
3637
37- const specContent = await readFile ( 'src/app/app.spec.ts' ) ;
38- assert . match (
39- specContent ,
40- / t o M a t c h I n l i n e S n a p s h o t \( ` " t e s t - p r o j e c t " ` \) / ,
41- 'Inline snapshot was not written to the spec file.' ,
42- ) ;
43-
4438 const snapshotContent = await readFile ( 'src/app/__snapshots__/app.spec.ts.snap' ) ;
4539 assert . match (
4640 snapshotContent ,
4741 / e x p o r t s \[ ` s h o u l d m a t c h f i l e s n a p s h o t 1 ` \] = ` " t e s t - p r o j e c t " ` ; / ,
4842 'File snapshot was not written to disk.' ,
4943 ) ;
5044
45+ const specContent = await readFile ( 'src/app/app.spec.ts' ) ;
46+ console . log ( specContent ) ;
47+ assert . match (
48+ specContent ,
49+ / t o M a t c h I n l i n e S n a p s h o t \( ` " t e s t - p r o j e c t " ` \) / ,
50+ 'Inline snapshot was not written to the spec file.' ,
51+ ) ;
52+
5153 // Second run: tests should pass with existing snapshots
5254 await ng ( 'test' ) ;
5355
0 commit comments