Skip to content

Commit 7615f6c

Browse files
committed
test: use which to find the package manager
1 parent babd66c commit 7615f6c

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@types/semver": ">=7",
3232
"@types/shelljs": "^0.8.11",
3333
"@types/weak-napi": "^2.0.1",
34+
"@types/which": "^2.0.1",
3435
"benchmark": ">=2",
3536
"chai": ">=4.3",
3637
"cross-env": "^7.0.3",
@@ -51,7 +52,8 @@
5152
"ts-morph": "^17.0.1",
5253
"ts-node": "10.9",
5354
"typescript": "4.9",
54-
"weak-napi": "^2.0.2"
55+
"weak-napi": "^2.0.2",
56+
"which": "^3.0.0"
5557
},
5658
"engines": {
5759
"node": ">= 10.2"

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/unit/typings-compatibility-test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
readFile,
99
writeFile,
1010
} from "fs-extra"
11+
import * as which from "which"
1112

1213
import {assert} from "chai"
1314

@@ -169,9 +170,7 @@ async function prepareTestPackage(
169170
async function getPackageManager() {
170171
const packageManagers = ["pnpm", "yarn", "npm"]
171172

172-
const versionResults = await Promise.all(
173-
packageManagers.map(pm => run(`${pm} --version`, tscTestBasePath, false)),
174-
)
173+
const versionResults = await Promise.all(packageManagers.map(pm => which(pm)))
175174

176175
const packageManagerIndex = versionResults.findIndex(
177176
versionResult => typeof versionResult === "string",

0 commit comments

Comments
 (0)