Skip to content

Commit 09a5e16

Browse files
committed
test: use cross-spawn in the tests
1 parent 00f3a11 commit 09a5e16

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@
4747
}
4848
},
4949
"devDependencies": {
50+
"@types/cross-spawn": "^6.0.2",
5051
"@types/jest": "^27.0.1",
5152
"@types/node": "^16.9.1",
5253
"@types/semver": "^7.3.8",
5354
"@types/which": "^2.0.1",
5455
"caxa": "^2.1.0",
5556
"cross-env": "7.0.3",
57+
"cross-spawn": "^7.0.3",
5658
"eslint-config-atomic": "^1.16.2",
5759
"jest": "^27.2.0",
5860
"npm-run-all2": "^5.0.2",
@@ -61,8 +63,7 @@
6163
"shx": "0.3.3",
6264
"terser-config-atomic": "^0.1.1",
6365
"ts-jest": "^27.0.5",
64-
"typescript": "^4.4.3",
65-
"escape-path-with-spaces": "^1.0.0"
66+
"typescript": "^4.4.3"
6667
},
6768
"keywords": [
6869
"github-actions",

pnpm-lock.yaml

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

src/utils/tests/test-helpers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { tmpdir } from "os"
33
import * as path from "path"
44
import { addBinExtension } from "../setup/setupBin"
55
import { join } from "path"
6-
import { exec } from "@actions/exec"
7-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
8-
// @ts-ignore
9-
import escape from "escape-path-with-spaces"
6+
import spawn from "cross-spawn"
107

118
export async function setupTmpDir(testName: string) {
129
const tempDirectory = path.join(tmpdir(), "setup-cpp", testName)
@@ -49,7 +46,7 @@ export async function testBin(
4946
}
5047

5148
if (args !== null) {
52-
const status = await exec(escape(bin) as string, args)
49+
const { status } = spawn.sync(bin, args, { stdio: "inherit" })
5350
expect(status).toBe(0)
5451
}
5552

0 commit comments

Comments
 (0)