Skip to content

Commit 1c1ac8b

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 1c1ac8b

File tree

12 files changed

+68
-25
lines changed

12 files changed

+68
-25
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/utilities/package-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ export class PackageManagerUtils {
158158
};
159159
case PackageManager.Bun:
160160
return {
161-
saveDev: '--development',
161+
saveDev: '--dev',
162162
install: 'add',
163163
installAll: 'install',
164164
prefix: '--cwd',
165-
noLockfile: '',
165+
noLockfile: '--no-save',
166166
};
167167
default:
168168
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/assets/add-collection/collection.json renamed to tests/legacy-cli/e2e/assets/add-collection-dir/collection.json

File renamed without changes.
File renamed without changes.

tests/legacy-cli/e2e/assets/add-collection/package.json renamed to tests/legacy-cli/e2e/assets/add-collection-dir/package.json

File renamed without changes.

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');
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
import { cp } from 'node:fs/promises';
2+
import { resolve } from 'node:path';
13
import { assetDir } from '../../../utils/assets';
24
import { expectFileToExist } from '../../../utils/fs';
35
import { ng } from '../../../utils/process';
46

57
export default async function () {
6-
await ng('add', assetDir('add-collection'), '--name=blah', '--skip-confirmation');
8+
const collectionName = 'add-collection-dir';
9+
const dirCollectionPath = resolve(collectionName);
10+
11+
// Copy locally as bun doesn't install the dependency correctly if it has symlinks.
12+
await cp(assetDir(collectionName), dirCollectionPath, {
13+
recursive: true,
14+
dereference: true,
15+
});
16+
17+
await ng('add', dirCollectionPath, '--name=blah', '--skip-confirmation');
718
await expectFileToExist('blah');
819
}

0 commit comments

Comments
 (0)