Skip to content

Commit e45411e

Browse files
authored
Fix flaky Bun test (#76763)
1 parent 0940320 commit e45411e

File tree

1 file changed

+9
-3
lines changed
  • test/integration/create-next-app/package-manager

1 file changed

+9
-3
lines changed

test/integration/create-next-app/package-manager/bun.test.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import execa from 'execa'
2+
import * as semver from 'semver'
13
import {
24
command,
35
DEFAULT_FILES,
@@ -7,11 +9,9 @@ import {
79
useTempDir,
810
} from '../utils'
911

10-
const lockFile = 'bun.lockb'
11-
const files = [...DEFAULT_FILES, lockFile]
12-
1312
describe('create-next-app with package manager bun', () => {
1413
let nextTgzFilename: string
14+
let files: string[]
1515

1616
beforeAll(async () => {
1717
if (!process.env.NEXT_TEST_PKG_PATHS) {
@@ -27,6 +27,12 @@ describe('create-next-app with package manager bun', () => {
2727
await command('bun', ['--version'])
2828
// install bun if not available
2929
.catch(() => command('npm', ['i', '-g', 'bun']))
30+
31+
const bunVersion = (await execa('bun', ['--version'])).stdout.trim()
32+
// Some CI runners pre-install Bun.
33+
// Locally, we don't pin Bun either.
34+
const lockFile = semver.gte(bunVersion, '1.2.0') ? 'bun.lock' : 'bun.lockb'
35+
files = [...DEFAULT_FILES, lockFile]
3036
})
3137

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

0 commit comments

Comments
 (0)