Skip to content

Commit

Permalink
Fix flaky Bun test
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 3, 2025
1 parent 58a22f7 commit 3111d49
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/integration/create-next-app/package-manager/bun.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as semver from 'semver'
import {
command,
DEFAULT_FILES,
Expand All @@ -7,11 +8,9 @@ import {
useTempDir,
} from '../utils'

const lockFile = 'bun.lockb'
const files = [...DEFAULT_FILES, lockFile]

describe('create-next-app with package manager bun', () => {
let nextTgzFilename: string
let files: string[]

beforeAll(async () => {
if (!process.env.NEXT_TEST_PKG_PATHS) {
Expand All @@ -27,6 +26,12 @@ describe('create-next-app with package manager bun', () => {
await command('bun', ['--version'])
// install bun if not available
.catch(() => command('npm', ['i', '-g', 'bun']))

const bunVersion = (await command('bun', ['--version'])).stdout.trim()
// Some CI runners pre-install Bun.
// Locally, we don't pin Bun either.
const lockFile = semver.gte(bunVersion, '1.2.0') ? 'bun.lock' : 'bun.lockb'
files = [...DEFAULT_FILES, lockFile]
})

it('should use bun for --use-bun flag', async () => {
Expand Down

0 comments on commit 3111d49

Please sign in to comment.