diff --git a/packages/wxt/src/core/package-managers/__tests__/pnpm.test.ts b/packages/wxt/src/core/package-managers/__tests__/pnpm.test.ts index ab05424d..cf4d13d4 100644 --- a/packages/wxt/src/core/package-managers/__tests__/pnpm.test.ts +++ b/packages/wxt/src/core/package-managers/__tests__/pnpm.test.ts @@ -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'); diff --git a/packages/wxt/src/core/package-managers/__tests__/yarn.test.ts b/packages/wxt/src/core/package-managers/__tests__/yarn.test.ts index 40415b7d..68654900 100644 --- a/packages/wxt/src/core/package-managers/__tests__/yarn.test.ts +++ b/packages/wxt/src/core/package-managers/__tests__/yarn.test.ts @@ -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'); diff --git a/packages/wxt/src/core/utils/testing/fixtures.ts b/packages/wxt/src/core/utils/testing/fixtures.ts new file mode 100644 index 00000000..9d233390 --- /dev/null +++ b/packages/wxt/src/core/utils/testing/fixtures.ts @@ -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); +}