chore: skip package manager tests when binaries are missing (#2441)

Co-authored-by: Aaron <aaronklinker1@gmail.com>
This commit is contained in:
T
2026-06-29 11:44:35 -03:00
committed by GitHub
parent cfc633202b
commit fc269ed78d
3 changed files with 21 additions and 2 deletions
@@ -2,10 +2,11 @@ import spawn from 'nano-spawn';
import path from 'node:path';
import { beforeAll, describe, expect, it } from 'vitest';
import { pnpm } from '../pnpm';
import { describeWithBin } from '../../utils/testing/fixtures';
process.env.WXT_PNPM_IGNORE_WORKSPACE = 'true';
describe('PNPM Package Management Utils', () => {
describeWithBin('pnpm', 'PNPM Package Management Utils', () => {
describe('listDependencies', () => {
const cwd = path.resolve(__dirname, 'fixtures/simple-pnpm-project');
@@ -1,8 +1,9 @@
import { describe, expect, it } from 'vitest';
import path from 'node:path';
import { yarn } from '../yarn';
import { describeWithBin } from '../../utils/testing/fixtures';
describe('Yarn Package Management Utils', () => {
describeWithBin('yarn', 'Yarn Package Management Utils', () => {
describe('listDependencies', () => {
const cwd = path.resolve(__dirname, 'fixtures/simple-yarn-project');
@@ -0,0 +1,17 @@
import { spawnSync } from 'node:child_process';
import { describe } from 'vitest';
export function describeWithBin(
bin: string,
title: string,
callback: () => void,
) {
if (process.env.CI === 'true') return describe(title, callback);
const result = spawnSync(bin, ['--version'], {
stdio: 'ignore',
shell: true,
});
if (result.status !== 0) return describe.skip(title, callback);
return describe(title, callback);
}