diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6e2394..5522687 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,8 @@ jobs: uses: pnpm/action-setup@v3 with: version: 9 + - name: Install Bun + uses: oven-sh/setup-bun@v1 - name: Install Node.js uses: actions/setup-node@v4 with: @@ -43,6 +45,8 @@ jobs: uses: pnpm/action-setup@v3 with: version: 9 + - name: Install Bun + uses: oven-sh/setup-bun@v1 - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: @@ -67,6 +71,8 @@ jobs: uses: pnpm/action-setup@v3 with: version: 7 + - name: Install Bun + uses: oven-sh/setup-bun@v1 - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: diff --git a/index.js b/index.js index b626a23..fe0f81e 100644 --- a/index.js +++ b/index.js @@ -46,6 +46,8 @@ function detectLockfile() { if (existsSync(lockfilePnpm)) { return { file: lockfilePnpm, mode: 'pnpm' } + } else if (existsSync(lockfileBun)) { + return { file: lockfileBun, mode: 'bun' } } else if (existsSync(lockfileNpm)) { return { file: lockfileNpm, mode: 'npm' } } else if (existsSync(lockfileYarn)) { diff --git a/test/index.test.js b/test/index.test.js index 496fbb3..7e4c93a 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -265,7 +265,7 @@ test('updates caniuse-lite for pnpm', async () => { }) test('updates caniuse-lite for bun', async () => { - let dir = await chdir('update-bun', 'package.json', 'bun.lockb') + await chdir('update-bun', 'package.json', 'bun.lockb') match( runUpdate(), `Latest version: ${caniuse.version}\n` + @@ -274,8 +274,8 @@ test('updates caniuse-lite for bun', async () => { 'caniuse-lite has been successfully updated\n' ) - let lock = (await readFile(join(dir, 'bun.lockb'))).toString() - ok(lock.includes(`/caniuse-lite-${caniuse.version}`)) + let pmls = execSync('bun pm ls --all', { env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" } }).toString() + ok(pmls.includes(`caniuse-lite@${caniuse.version}`)) }) test.run()