mirror of https://github.com/aminya/setup-cpp
test: escape path in the exec in the test
This commit is contained in:
parent
bf456808b6
commit
a8477cb234
|
@ -61,7 +61,8 @@
|
||||||
"shx": "0.3.3",
|
"shx": "0.3.3",
|
||||||
"terser-config-atomic": "^0.1.1",
|
"terser-config-atomic": "^0.1.1",
|
||||||
"ts-jest": "^27.0.5",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^4.4.3"
|
"typescript": "^4.4.3",
|
||||||
|
"escape-path-with-spaces": "^1.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github-actions",
|
"github-actions",
|
||||||
|
|
|
@ -17,6 +17,7 @@ importers:
|
||||||
'@types/which': ^2.0.1
|
'@types/which': ^2.0.1
|
||||||
caxa: ^2.1.0
|
caxa: ^2.1.0
|
||||||
cross-env: 7.0.3
|
cross-env: 7.0.3
|
||||||
|
escape-path-with-spaces: ^1.0.0
|
||||||
eslint-config-atomic: ^1.16.2
|
eslint-config-atomic: ^1.16.2
|
||||||
hasha: ^5.2.2
|
hasha: ^5.2.2
|
||||||
jest: ^27.2.0
|
jest: ^27.2.0
|
||||||
|
@ -44,6 +45,7 @@ importers:
|
||||||
'@types/which': 2.0.1
|
'@types/which': 2.0.1
|
||||||
caxa: 2.1.0
|
caxa: 2.1.0
|
||||||
cross-env: 7.0.3
|
cross-env: 7.0.3
|
||||||
|
escape-path-with-spaces: 1.0.0
|
||||||
eslint-config-atomic: 1.16.2
|
eslint-config-atomic: 1.16.2
|
||||||
jest: 27.2.0
|
jest: 27.2.0
|
||||||
npm-run-all2: 5.0.2
|
npm-run-all2: 5.0.2
|
||||||
|
@ -3373,6 +3375,10 @@ packages:
|
||||||
resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=}
|
resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/escape-path-with-spaces/1.0.0:
|
||||||
|
resolution: {integrity: sha512-+98Hh0yzVa0hldJXlzr0M/8B8LVXW9vNT5boC9k6o896Z52DGRplm3NwMGX0590ryGSegzTf/uaUiusFj2SQbQ==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/escape-string-regexp/1.0.5:
|
/escape-string-regexp/1.0.5:
|
||||||
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
|
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
|
||||||
engines: {node: '>=0.8.0'}
|
engines: {node: '>=0.8.0'}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import * as path from "path"
|
||||||
import { addBinExtension } from "../setup/setupBin"
|
import { addBinExtension } from "../setup/setupBin"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import { exec } from "@actions/exec"
|
import { exec } from "@actions/exec"
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
import escape from "escape-path-with-spaces"
|
||||||
|
|
||||||
export async function setupTmpDir(testName: string) {
|
export async function setupTmpDir(testName: string) {
|
||||||
const tempDirectory = path.join(tmpdir(), "setup-cpp", testName)
|
const tempDirectory = path.join(tmpdir(), "setup-cpp", testName)
|
||||||
|
@ -41,7 +44,7 @@ export async function testBin(name: string, args: string[] = ["--version"], binD
|
||||||
bin = join(binDir, addBinExtension(name))
|
bin = join(binDir, addBinExtension(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
const status = await exec(bin, args)
|
const status = await exec(escape(bin) as string, args)
|
||||||
expect(status).toBe(0)
|
expect(status).toBe(0)
|
||||||
|
|
||||||
expect(await io.which(name, true)).toBe(bin)
|
expect(await io.which(name, true)).toBe(bin)
|
||||||
|
|
Loading…
Reference in New Issue