Skip to content

Commit 3111d49

Browse files
committed
Fix flaky Bun test
1 parent 58a22f7 commit 3111d49

File tree

1 file changed

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

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as semver from 'semver'
12
import {
23
command,
34
DEFAULT_FILES,
@@ -7,11 +8,9 @@ import {
78
useTempDir,
89
} from '../utils'
910

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

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

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

0 commit comments

Comments
 (0)