Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function () {
['serve', '--port', `${port}`],
/bundle generation complete/,
// Use CI:0 to force caching
{ DEBUG: 'vite:deps', CI: '0' },
{ DEBUG: 'vite:deps', CI: '0', NO_COLOR: 'true' },
);

// Wait for vite to write to FS and stablize.
Expand All @@ -33,7 +33,6 @@ export default async function () {
// Terminate the dev-server
await killAllProcesses();

// The Node.js specific module should not be found
await execAndWaitForOutputToMatch(
'ng',
['serve', '--port=0'],
Expand Down
31 changes: 21 additions & 10 deletions tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import assert from 'node:assert';
import { setTimeout } from 'node:timers/promises';
import { ng, waitForAnyProcessOutputToMatch } from '../../utils/process';
import {
execAndWaitForOutputToMatch,
ng,
waitForAnyProcessOutputToMatch,
} from '../../utils/process';
import { installWorkspacePackages, uninstallPackage } from '../../utils/packages';
import { ngServe, useSha } from '../../utils/project';
import { useSha } from '../../utils/project';
import { getGlobalVariable } from '../../utils/env';
import { readFile, writeFile } from '../../utils/fs';
import { findFreePort } from '../../utils/network';

export default async function () {
assert(
Expand All @@ -22,20 +26,27 @@ export default async function () {
await useSha();
await installWorkspacePackages();

const port = await ngServe();
const port = await findFreePort();
await execAndWaitForOutputToMatch(
'ng',
['serve', '--port', port.toString()],
/Application bundle generation complete/,
{ CI: '0', NO_COLOR: 'true' },
);
await validateResponse('/', /Hello,/);

const appConfigContentsUpdated = `
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
${(await readFile('src/app/app.config.ts')).replace('provideRouter(routes),', 'provideAnimationsAsync(), provideRouter(routes),')}
`;

await Promise.all([
waitForAnyProcessOutputToMatch(
/new dependencies optimized: @angular\/platform-browser\/animations\/async/,
6000,
),
setTimeout(200).then(() => writeFile('src/app/app.config.ts', appConfigContentsUpdated)),
writeFile(
'src/app/app.config.ts',
`
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
${(await readFile('src/app/app.config.ts')).replace('provideRouter(routes),', 'provideAnimationsAsync(), provideRouter(routes),')}
`,
),
]);

// Verify the app still works.
Expand Down
Loading