Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions tests/legacy-cli/e2e/tests/vite/reuse-dep-optimization-cache.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
import assert from 'node:assert';
import { setTimeout } from 'node:timers/promises';
import { findFreePort } from '../../utils/network';
import { execAndWaitForOutputToMatch, killAllProcesses, ng } from '../../utils/process';
import {
execAndWaitForOutputToMatch,
killAllProcesses,
ng,
waitForAnyProcessOutputToMatch,
} from '../../utils/process';

export default async function () {
await ng('cache', 'clean');
await ng('cache', 'on');

const port = await findFreePort();
await execAndWaitForOutputToMatch(
'ng',
['serve', '--port', `${port}`],
/Application bundle generation complete/,
// Use CI:0 to force caching
{ DEBUG: 'vite:deps', CI: '0', NO_COLOR: 'true' },
);

const [, response] = await Promise.all([
execAndWaitForOutputToMatch(
'ng',
['serve', '--port', `${port}`],
/dependencies optimized/,
// Use CI:0 to force caching
{ DEBUG: 'vite:deps', CI: '0', NO_COLOR: 'true' },
),
setTimeout(4_000).then(() => fetch(`http://localhost:${port}/main.js`)),
waitForAnyProcessOutputToMatch(/dependencies optimized/, 10_000),
fetch(`http://localhost:${port}/main.js`),
]);

assert(response.ok, `Expected 'response.ok' to be 'true'.`);
Expand Down
Loading