@@ -9,8 +9,9 @@ import * as assert from 'uvu/assert';
99import { suite } from 'uvu' ;
1010import { rigTest } from './util/rig-test.js' ;
1111import { WireitTestRig } from './util/test-rig.js' ;
12- import { Options } from '../cli-options.js' ;
12+ import { Agent , Options } from '../cli-options.js' ;
1313import { Result } from '../error.js' ;
14+ import { IS_WINDOWS } from '../util/windows.js' ;
1415
1516const test = suite < object > ( ) ;
1617
@@ -39,7 +40,38 @@ async function getOptionsResult(
3940 } ,
4041 } ,
4142 } ) ;
42- env = { ...env , WIREIT_DEBUG_LOG_FILE : '' } ;
43+
44+ if ( command . startsWith ( 'yarnBerry' ) ) {
45+ await rig . write ( {
46+ 'yarn.lock' : `# This file is generated by running "yarn install" inside your project.
47+ # Manual changes might be lost - proceed with caution!
48+
49+ __metadata:
50+ version: 8
51+ cacheKey: 10c0
52+
53+ "root-workspace-0b6124@workspace:.":
54+ version: 0.0.0-use.local
55+ resolution: "root-workspace-0b6124@workspace:."
56+ languageName: unknown
57+ linkType: soft
58+ ` ,
59+ } ) ;
60+ await rig . write ( {
61+ '.yarnrc.yml' : 'nodeLinker: node-modules' ,
62+ } ) ;
63+ }
64+
65+ const PATH_SEPARATOR = IS_WINDOWS ? `;` : `:` ;
66+
67+ env = {
68+ ...env ,
69+ WIREIT_DEBUG_LOG_FILE : '' ,
70+ PATH : `${ env ?. PATH ?? process . env . PATH } ${ PATH_SEPARATOR } ${
71+ rig . temp
72+ } /node_modules/.bin`,
73+ } ;
74+
4375 assert . equal ( ( await rig . exec ( command , { env} ) . exit ) . code , 0 ) ;
4476 return JSON . parse ( await rig . read ( 'options.json' ) ) as Result < Options > ;
4577}
@@ -67,8 +99,8 @@ async function assertOptions(
6799 } ) ;
68100}
69101
70- for ( const command of [ 'npm' , 'yarn' , 'pnpm' ] as const ) {
71- const agent = command === 'yarn' ? 'yarnClassic' : command ;
102+ for ( const command of [ 'npm' , 'yarn' , 'pnpm' , 'yarnBerry' ] as const ) {
103+ const agent : Agent = command === 'yarn' ? 'yarnClassic' : command ;
72104 // eslint-disable-next-line @typescript-eslint/unbound-method
73105 const skipIfYarn = command === 'yarn' ? test . skip : test ;
74106 // eslint-disable-next-line @typescript-eslint/unbound-method
@@ -87,6 +119,19 @@ for (const command of ['npm', 'yarn', 'pnpm'] as const) {
87119 } ) ,
88120 ) ;
89121
122+ test (
123+ `${ command } run main` ,
124+ rigTest ( async ( { rig} ) => {
125+ await assertOptions ( rig , `${ command } run main` , {
126+ agent,
127+ script : {
128+ packageDir : rig . temp ,
129+ name : 'main' ,
130+ } ,
131+ } ) ;
132+ } ) ,
133+ ) ;
134+
90135 test (
91136 `${ command } test` ,
92137 rigTest ( async ( { rig} ) => {
0 commit comments