diff --git a/src/test/cli-options.test.ts b/src/test/cli-options.test.ts index d271b501a..98851e806 100644 --- a/src/test/cli-options.test.ts +++ b/src/test/cli-options.test.ts @@ -9,7 +9,7 @@ import * as assert from 'uvu/assert'; import {suite} from 'uvu'; import {rigTest} from './util/rig-test.js'; import {WireitTestRig} from './util/test-rig.js'; -import {Options} from '../cli-options.js'; +import {Agent, Options} from '../cli-options.js'; import {Result} from '../error.js'; const test = suite(); @@ -67,8 +67,8 @@ async function assertOptions( }); } -for (const command of ['npm', 'yarn', 'pnpm'] as const) { - const agent = command === 'yarn' ? 'yarnClassic' : command; +for (const command of ['npm', 'yarn', 'pnpm', 'yarnBerry'] as const) { + const agent: Agent = command === 'yarn' ? 'yarnClassic' : command; // eslint-disable-next-line @typescript-eslint/unbound-method const skipIfYarn = command === 'yarn' ? test.skip : test; // eslint-disable-next-line @typescript-eslint/unbound-method diff --git a/src/test/util/test-rig.ts b/src/test/util/test-rig.ts index 488cf2946..a52c86a94 100644 --- a/src/test/util/test-rig.ts +++ b/src/test/util/test-rig.ts @@ -64,22 +64,33 @@ export class WireitTestRig */ override async setup() { await super.setup(); - const absWireitBinaryPath = pathlib.resolve(repoRoot, 'bin', 'wireit.js'); - const absWireitTempInstallPath = pathlib.resolve( - this.temp, - 'node_modules', - '.bin', - 'wireit', + + Promise.all( + [ + ['wireit', ['bin', 'wireit.js']] as const, + ['yarnBerry', ['third_party', '.yarn', 'releases', 'yarn-4.0.1.cjs']] as const, + ].map( + async ([ name, pathParts ]) => { + const binaryPath = pathlib.resolve(repoRoot, ...pathParts); + const tempInstallPath = pathlib.resolve( + this.temp, + 'node_modules', + '.bin', + name, + ); + + if (IS_WINDOWS) { + // Npm install works differently on Windows, since it won't recognize a + // shebang like "#!/usr/bin/env node". Npm instead uses the cmd-shim + // package to generate Windows shell wrappers for each binary, so we do + // that here too. + await cmdShim(binaryPath, tempInstallPath); + } else { + await this.symlink(binaryPath, tempInstallPath, 'file'); + } + } + ) ); - if (IS_WINDOWS) { - // Npm install works differently on Windows, since it won't recognize a - // shebang like "#!/usr/bin/env node". Npm instead uses the cmd-shim - // package to generate Windows shell wrappers for each binary, so we do - // that here too. - await cmdShim(absWireitBinaryPath, absWireitTempInstallPath); - } else { - await this.symlink(absWireitBinaryPath, absWireitTempInstallPath, 'file'); - } } /**