diff --git a/test/integration/create-next-app/package-manager/bun.test.ts b/test/integration/create-next-app/package-manager/bun.test.ts index d3a682d6fd9554..6abcd9d45b6616 100644 --- a/test/integration/create-next-app/package-manager/bun.test.ts +++ b/test/integration/create-next-app/package-manager/bun.test.ts @@ -1,3 +1,4 @@ +import * as semver from 'semver' import { command, DEFAULT_FILES, @@ -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) { @@ -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 () => {