Skip to content

Commit

Permalink
test: prefer pnpm install w/ fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Nov 13, 2024
1 parent 05b0b90 commit af72126
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
},
"devDependencies": {
"@eslint-sukka/node": "^6.7.0",
"@jsdevtools/ez-spawn": "^3.0.4",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
Expand All @@ -49,6 +48,7 @@
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.9",
"@types/node": "^22.7.5",
"@types/which": "^3.0.4",
"chai": "^4.5.0",
"eslint": "^9.12.0",
"eslint-config-sukka": "^6.7.0",
Expand All @@ -63,8 +63,10 @@
"rollup-plugin-dts": "^6.1.1",
"rollup2": "npm:rollup@^2.79.2",
"rollup3": "npm:rollup@^3.29.5",
"tinyexec": "^0.3.1",
"typescript": "^5.6.3",
"vite": "^5.4.8"
"vite": "^5.4.8",
"which": "^5.0.0"
},
"peerDependencies": {
"@swc/core": ">=1.2.165",
Expand Down
31 changes: 28 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot';

import { create, destroy } from 'memdisk';

import { async as ezspawn } from '@jsdevtools/ez-spawn';
import which from 'which';
import { exec } from 'tinyexec';

chai.should();
chai.use(jestSnapshotPlugin());
Expand Down Expand Up @@ -130,7 +131,8 @@ function tests(rollupImpl: typeof rollup2 | typeof rollup3 | typeof rollup4, iso
await Promise.all(files.map(([from, to]) => fsp.copyFile(from, to)));

if (requireInstall) {
await ezspawn('npm install', { cwd: testDir });
const packageManager = (await which('pnpm', { nothrow: true })) || 'npm';
await exec(packageManager, ['install'], { throwOnError: true, nodeOptions: { cwd: testDir } });
}

return testDir;
Expand Down

0 comments on commit af72126

Please sign in to comment.