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
6 changes: 4 additions & 2 deletions tests/e2e.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def _e2e_suite(name, runner, type, data, toolchain_name = "", toolchain = None):
args = []
tests = None
ignore = None
shard_count = TEST_SHARD_COUNT

if toolchain_name:
toolchain_name = "_" + toolchain_name
Expand All @@ -168,6 +169,7 @@ def _e2e_suite(name, runner, type, data, toolchain_name = "", toolchain = None):
args.append("--esbuild")
tests = BROWSER_TESTS
ignore = None
shard_count = 1
elif type == "webpack":
tests = None
ignore = BROWSER_TESTS + WEBPACK_IGNORE_TESTS
Expand All @@ -179,7 +181,7 @@ def _e2e_suite(name, runner, type, data, toolchain_name = "", toolchain = None):
size = "enormous",
data = data,
toolchain = toolchain,
shard_count = TEST_SHARD_COUNT,
shard_count = shard_count,
templated_args = args + [
"--glob=%s" % _to_glob(tests) if tests else "",
"--ignore=%s" % _to_glob(ignore) if ignore else "",
Expand All @@ -193,7 +195,7 @@ def _e2e_suite(name, runner, type, data, toolchain_name = "", toolchain = None):
size = "enormous",
data = data,
toolchain = toolchain,
shard_count = TEST_SHARD_COUNT,
shard_count = shard_count,
templated_args = args + [
"--ng-snapshots",
"--glob=%s" % _to_glob(tests) if tests else "",
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/tests/misc/browsers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import express from 'express';
import * as path from 'node:path';
import path from 'node:path';
import { copyProjectAsset } from '../../utils/assets';
import { appendToFile, createDir, replaceInFile, writeFile } from '../../utils/fs';
import { exec, ng } from '../../utils/process';
Expand All @@ -21,9 +21,7 @@ export default async function () {
throw new Error('SauceLabs is not configured.');
}

for (const e2eDep of E2E_DEV_DEPENDENCIES) {
await installPackage(e2eDep);
}
await installPackage(E2E_DEV_DEPENDENCIES);

await appendToFile(
'src/app/app.config.ts',
Expand Down
17 changes: 11 additions & 6 deletions tests/e2e/utils/packages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getGlobalVariable } from './env';
import { ProcessOutput, silentBun, silentNpm, silentPnpm, silentYarn } from './process';
import { type ProcessOutput, silentBun, silentNpm, silentPnpm, silentYarn } from './process';

export interface PkgInfo {
readonly name: string;
Expand Down Expand Up @@ -32,17 +32,22 @@ export async function installWorkspacePackages(options?: { force?: boolean }): P
}
}

export function installPackage(specifier: string, registry?: string): Promise<ProcessOutput> {
export function installPackage(
specifier: string | string[],
registry?: string,
): Promise<ProcessOutput> {
const registryOption = registry ? [`--registry=${registry}`] : [];
const specifiers = Array.isArray(specifier) ? specifier : [specifier];

Comment thread
alan-agius4 marked this conversation as resolved.
Resolved
switch (getActivePackageManager()) {
case 'npm':
return silentNpm('install', specifier, ...registryOption);
return silentNpm('install', ...specifiers, ...registryOption);
case 'yarn':
return silentYarn('add', specifier, ...registryOption);
return silentYarn('add', ...specifiers, ...registryOption);
case 'bun':
return silentBun('add', specifier, ...registryOption);
return silentBun('add', ...specifiers, ...registryOption);
case 'pnpm':
return silentPnpm('add', specifier, ...registryOption);
return silentPnpm('add', ...specifiers, ...registryOption);
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/utils/test_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const testFunction: () => Promise<void> | void =
throw new Error('Invalid test module.');
};

// 4-minute timeout to prevent hanging tests from blocking the runner indefinitely.
const TEST_TIMEOUT_MS = 4 * 60 * 1000;
// 8-minute timeout to prevent hanging tests from blocking the runner indefinitely.
const TEST_TIMEOUT_MS = 8 * 60 * 1000;

(async () => {
let timeoutId: NodeJS.Timeout | undefined;
try {
const timeoutPromise = new Promise<never>((_, reject) => {
timeoutId = setTimeout(() => {
reject(new Error(`Test "${testScript}" timed out after 4 minutes.`));
reject(new Error(`Test "${testScript}" timed out after 8 minutes.`));
}, TEST_TIMEOUT_MS);
Comment thread
alan-agius4 marked this conversation as resolved.
Resolved
});

Expand Down
Loading