Skip to content

Commit b3acef0

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

File tree

1 file changed

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

1 file changed

+13
-3
lines changed

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

+13-3
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,17 @@ 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 bunVersionCommand = await command('bun', ['--version'])
31+
console.log(
32+
{ bunVersionCommand },
33+
{ stdout: bunVersionCommand.stdout, stderr: bunVersionCommand.stderr }
34+
)
35+
const bunVersion = bunVersionCommand.stdout.trim()
36+
// Some CI runners pre-install Bun.
37+
// Locally, we don't pin Bun either.
38+
const lockFile = semver.gte(bunVersion, '1.2.0') ? 'bun.lock' : 'bun.lockb'
39+
files = [...DEFAULT_FILES, lockFile]
3040
})
3141

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

0 commit comments

Comments
 (0)