Skip to content

Commit

Permalink
Try fixing Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 31, 2018
1 parent d1b7674 commit ab4d031
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions test/helpers/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict'

const { platform } = require('process')

const execa = require('execa')
const isCi = require('is-ci')

Expand All @@ -11,8 +9,7 @@ const BINARY_PATH = `${__dirname}/../../localpack/bin/unix_permissions.js`
// exception throwing
const testCli = async function({ t, output, error, command, args }) {
// We only run this in CI because it's slow.
// Windows somehow freezes in CI.
if (!isCi || platform === 'win32' || !args.some(isValidCliArgument)) {
if (!isCi || !args.some(isValidCliArgument)) {
return
}

Expand All @@ -31,10 +28,9 @@ const isValidCliArgument = function(arg) {

// Fire CLI command
const fireBinary = async function(command, ...args) {
const argsA = args.map(escapeArg).join(' ')

const { stdout, stderr, code } = await execa.shell(
`${BINARY_PATH} ${command} ${argsA}`,
const { stdout, stderr, code } = await execa(
BINARY_PATH,
[command, ...args],
{ reject: false },
)

Expand All @@ -43,10 +39,6 @@ const fireBinary = async function(command, ...args) {
return { stdout: stdoutA, stderr: stderrA, code }
}

const escapeArg = function(arg) {
return String(arg).replace(/\s/gu, '\\$&')
}

const normalizeOutput = function({ output, error }) {
if (typeof output === 'boolean') {
return { output: '', error: !output }
Expand Down

0 comments on commit ab4d031

Please sign in to comment.