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 b3acef0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 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,17 @@ describe('create-next-app with package manager bun', () => {
await command('bun', ['--version'])
// install bun if not available
.catch(() => command('npm', ['i', '-g', 'bun']))

const bunVersionCommand = await command('bun', ['--version'])
console.log(
{ bunVersionCommand },
{ stdout: bunVersionCommand.stdout, stderr: bunVersionCommand.stderr }
)
const bunVersion = bunVersionCommand.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 b3acef0

Please sign in to comment.