Skip to content

Commit 1737ce2

Browse files
alan-agius4dgp1130
authored andcommitted
ci: add bun package manager to e2e tests
This commit introduces support for the `bun` package manager in our end-to-end tests. (cherry picked from commit 76ed178)
1 parent 59ff867 commit 1737ce2

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
@@ -162,7 +162,7 @@ jobs:
162162
matrix:
163163
os: [ubuntu-latest]
164164
node: [22]
165-
subset: [yarn, pnpm]
165+
subset: [yarn, pnpm, bun]
166166
shard: [0, 1, 2]
167167
runs-on: ${{ matrix.os }}
168168
steps:

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180
matrix:
181181
os: [ubuntu-latest]
182182
node: [22]
183-
subset: [yarn, pnpm]
183+
subset: [yarn, pnpm, bun]
184184
shard: [0, 1, 2]
185185
runs-on: ${{ matrix.os }}
186186
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+
// 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)