Skip to content

Commit 6a8ce23

Browse files
committed
ci: add bun package manager to e2e tests
This commit introduces support for the `bun` package manager in our end-to-end tests. The following changes are included: - The `bun` package manager is now part of the test matrix in the CI configuration. - The package manager flags for `bun` have been updated to align with the latest version. - The `ng add` command has been updated to support `bun`, including a workaround for a symlink issue. - Tests that are not compatible with `bun`, such as those for unscoped authentication, are now skipped when `bun` the active package manager.
1 parent 41c6798 commit 6a8ce23

File tree

13 files changed

+95
-50
lines changed

13 files changed

+95
-50
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
# flaky targets are retried. The larger machine type comes with 2x more SSD space.
165165
os: [ubuntu-latest-4core]
166166
node: [22]
167-
subset: [yarn, pnpm]
167+
subset: [yarn, pnpm, bun]
168168
shard: [0, 1, 2]
169169
runs-on: ${{ matrix.os }}
170170
steps:

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
# flaky targets are retried. The larger machine type comes with 2x more SSD space.
183183
os: [ubuntu-latest-4core]
184184
node: [22]
185-
subset: [yarn, pnpm]
185+
subset: [yarn, pnpm, bun]
186186
shard: [0, 1, 2]
187187
runs-on: ${{ matrix.os }}
188188
steps:

packages/angular/cli/src/commands/add/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ export default class AddCommandModule
493493
// Only show if installation will actually occur
494494
task.title = 'Installing package';
495495

496-
if (context.savePackage === false) {
496+
if (context.savePackage === false && packageManager.name !== PackageManager.Bun) {
497+
// Bun has a `--no-save` option which we are using to
498+
// save install the package and not update the package.json and the lock file.
497499
task.title += ' in temporary location';
498500

499501
// Temporary packages are located in a different directory

packages/angular/cli/src/utilities/package-manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class PackageManagerUtils {
6161
/** Install a single package. */
6262
async install(
6363
packageName: string,
64-
save: 'dependencies' | 'devDependencies' | true = true,
64+
save: 'dependencies' | 'devDependencies' | boolean = true,
6565
extraArgs: string[] = [],
6666
cwd?: string,
6767
): Promise<boolean> {
@@ -70,6 +70,8 @@ export class PackageManagerUtils {
7070

7171
if (save === 'devDependencies') {
7272
installArgs.push(packageManagerArgs.saveDev);
73+
} else if (save === false) {
74+
installArgs.push(packageManagerArgs.noLockfile);
7375
}
7476

7577
return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
@@ -158,11 +160,11 @@ export class PackageManagerUtils {
158160
};
159161
case PackageManager.Bun:
160162
return {
161-
saveDev: '--development',
163+
saveDev: '--dev',
162164
install: 'add',
163165
installAll: 'install',
164166
prefix: '--cwd',
165-
noLockfile: '',
167+
noLockfile: '--no-save',
166168
};
167169
default:
168170
return {

tests/legacy-cli/e2e/assets/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ load("//tools:defaults.bzl", "copy_to_bin")
22

33
copy_to_bin(
44
name = "assets",
5-
srcs = glob(["**"]),
5+
srcs = glob(
6+
include = ["**"],
7+
exclude = ["BUILD.bazel"],
8+
),
69
visibility = ["//visibility:public"],
710
)

tests/legacy-cli/e2e/setup/100-global-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const PACKAGE_MANAGER_VERSION = {
66
'npm': '10.8.1',
77
'yarn': '1.22.22',
88
'pnpm': '10.17.1',
9-
'bun': '1.2.21',
9+
'bun': '1.3.2',
1010
};
1111

1212
export default async function () {

tests/legacy-cli/e2e/tests/commands/add/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ng } from '../../../utils/process';
44
import { expectToFail } from '../../../utils/utils';
55

66
export default async function () {
7-
await symlinkFile(assetDir('add-collection'), `./node_modules/add-collection`, 'dir');
7+
await symlinkFile(assetDir('add-collection-dir'), `./node_modules/add-collection`, 'dir');
88

99
await ng('add', 'add-collection');
1010
await expectFileToExist('empty-file');

0 commit comments

Comments
 (0)