Skip to content

Commit 643b93a

Browse files
committed
test: Introduce delay for file write to minimize flakiness
With recent updates to Vite, rebuild times have become significantly faster. To ensure reliable testing, we’ve added a deliberate delay to slow down the process during file writes.
1 parent 443fd53 commit 643b93a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import assert from 'node:assert';
2+
import { setTimeout } from 'node:timers/promises';
23
import { ng, waitForAnyProcessOutputToMatch } from '../../utils/process';
34
import { installWorkspacePackages, uninstallPackage } from '../../utils/packages';
45
import { ngServe, useSha } from '../../utils/project';
@@ -24,18 +25,17 @@ export default async function () {
2425
const port = await ngServe();
2526
await validateResponse('/', /Hello,/);
2627

28+
const appConfigContentsUpdated = `
29+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
30+
${(await readFile('src/app/app.config.ts')).replace('provideRouter(routes),', 'provideAnimationsAsync(), provideRouter(routes),')}
31+
`;
32+
2733
await Promise.all([
2834
waitForAnyProcessOutputToMatch(
2935
/new dependencies optimized: @angular\/platform-browser\/animations\/async/,
3036
6000,
3137
),
32-
writeFile(
33-
'src/app/app.config.ts',
34-
`
35-
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
36-
${(await readFile('src/app/app.config.ts')).replace('provideRouter(routes),', 'provideAnimationsAsync(), provideRouter(routes),')}
37-
`,
38-
),
38+
setTimeout(200).then(() => writeFile('src/app/app.config.ts', appConfigContentsUpdated)),
3939
]);
4040

4141
// Verify the app still works.

0 commit comments

Comments
 (0)