1
+ import * as semver from 'semver'
1
2
import {
2
3
command ,
3
4
DEFAULT_FILES ,
@@ -7,11 +8,9 @@ import {
7
8
useTempDir ,
8
9
} from '../utils'
9
10
10
- const lockFile = 'bun.lockb'
11
- const files = [ ...DEFAULT_FILES , lockFile ]
12
-
13
11
describe ( 'create-next-app with package manager bun' , ( ) => {
14
12
let nextTgzFilename : string
13
+ let files : string [ ]
15
14
16
15
beforeAll ( async ( ) => {
17
16
if ( ! process . env . NEXT_TEST_PKG_PATHS ) {
@@ -27,6 +26,17 @@ describe('create-next-app with package manager bun', () => {
27
26
await command ( 'bun' , [ '--version' ] )
28
27
// install bun if not available
29
28
. 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 ]
30
40
} )
31
41
32
42
it ( 'should use bun for --use-bun flag' , async ( ) => {
0 commit comments