Skip to content

Commit 44c18a2

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 44c18a2

File tree

11 files changed

+73
-24
lines changed

11 files changed

+73
-24
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 () {
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
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';
6+
import { expectToFail } from '../../../utils/utils';
47

58
export default async function () {
6-
await ng('add', assetDir('add-collection'), '--name=blah', '--skip-confirmation');
9+
const collectionName = 'add-collection-dir';
10+
const dirCollectionPath = resolve(collectionName);
11+
12+
// Copy locally as bun doesn't install the dependency correctly if it has symlinks.
13+
await cp(assetDir(collectionName), dirCollectionPath, {
14+
recursive: true,
15+
dereference: true,
16+
});
17+
18+
await ng('add', dirCollectionPath, '--name=blah', '--skip-confirmation');
719
await expectFileToExist('blah');
20+
21+
await ng('add', dirCollectionPath);
22+
await expectFileToExist('empty-file');
23+
24+
await expectToFail(() => ng('add', dirCollectionPath)); // File already exists.
825
}
Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
import assert from 'node:assert/strict';
22
import { assetDir } from '../../../utils/assets';
33
import { ng } from '../../../utils/process';
4+
import { resolve } from 'node:path';
5+
import { cp } from 'node:fs/promises';
46

57
const warning = 'Adding the package may not succeed.';
68

79
export default async function () {
8-
const { stdout: bad } = await ng(
9-
'add',
10-
assetDir('add-collection-peer-bad'),
11-
'--skip-confirmation',
12-
);
10+
const peerBadCollectionName = 'add-collection-peer-bad';
11+
const peerBadDirCollectionPath = resolve(peerBadCollectionName);
12+
13+
// Copy locally as bun doesn't install the dependency correctly if it has symlinks.
14+
await cp(assetDir(peerBadCollectionName), peerBadDirCollectionPath, {
15+
recursive: true,
16+
dereference: true,
17+
});
18+
19+
const { stdout: bad } = await ng('add', peerBadDirCollectionPath, '--skip-confirmation');
1320
assert.match(bad, new RegExp(warning), 'peer warning not shown on bad package');
1421

15-
const { stdout: base } = await ng('add', assetDir('add-collection'), '--skip-confirmation');
22+
const collectionName = 'add-collection-dir';
23+
const dirCollectionPath = resolve(collectionName);
24+
25+
// Copy locally as bun doesn't install the dependency correctly if it has symlinks.
26+
await cp(assetDir(collectionName), dirCollectionPath, {
27+
recursive: true,
28+
dereference: true,
29+
});
30+
31+
const { stdout: base } = await ng('add', dirCollectionPath, '--skip-confirmation');
1632
assert.doesNotMatch(base, new RegExp(warning), 'peer warning shown on base package');
1733

18-
const { stdout: good } = await ng(
19-
'add',
20-
assetDir('add-collection-peer-good'),
21-
'--skip-confirmation',
22-
);
34+
const peerGoodCollectionName = 'add-collection-peer-good';
35+
const peerGoodDirCollectionPath = resolve(peerGoodCollectionName);
36+
37+
// Copy locally as bun doesn't install the dependency correctly if it has symlinks.
38+
await cp(assetDir(peerGoodCollectionName), peerGoodDirCollectionPath, {
39+
recursive: true,
40+
dereference: true,
41+
});
42+
43+
const { stdout: good } = await ng('add', peerGoodDirCollectionPath, '--skip-confirmation');
2344
assert.doesNotMatch(good, new RegExp(warning), 'peer warning shown on good package');
2445
}

0 commit comments

Comments
 (0)