Unverified Commit e45411e9 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Fix flaky Bun test (#76763)

parent 09403207
import execa from 'execa'
import * as semver from 'semver'
import { import {
command, command,
DEFAULT_FILES, DEFAULT_FILES,
...@@ -7,11 +9,9 @@ import { ...@@ -7,11 +9,9 @@ import {
useTempDir, useTempDir,
} from '../utils' } from '../utils'
const lockFile = 'bun.lockb'
const files = [...DEFAULT_FILES, lockFile]
describe('create-next-app with package manager bun', () => { describe('create-next-app with package manager bun', () => {
let nextTgzFilename: string let nextTgzFilename: string
let files: string[]
beforeAll(async () => { beforeAll(async () => {
if (!process.env.NEXT_TEST_PKG_PATHS) { if (!process.env.NEXT_TEST_PKG_PATHS) {
...@@ -27,6 +27,12 @@ describe('create-next-app with package manager bun', () => { ...@@ -27,6 +27,12 @@ describe('create-next-app with package manager bun', () => {
await command('bun', ['--version']) await command('bun', ['--version'])
// install bun if not available // install bun if not available
.catch(() => command('npm', ['i', '-g', 'bun'])) .catch(() => command('npm', ['i', '-g', 'bun']))
const bunVersion = (await execa('bun', ['--version'])).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 () => { it('should use bun for --use-bun flag', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment