From 369e863155dfe933f2ab8ff388507bbe9a604c7e Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 19 Aug 2019 13:34:16 +0200 Subject: [PATCH] tweak execa usage --- e2e/Utils.ts | 2 +- e2e/runJest.ts | 6 +++--- packages/jest-circus/src/__mocks__/testUtils.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/Utils.ts b/e2e/Utils.ts index 1094ce358005..58421fb9f737 100644 --- a/e2e/Utils.ts +++ b/e2e/Utils.ts @@ -24,7 +24,7 @@ export const run = (cmd: string, cwd?: Config.Path): RunResult => { const result = spawnSync(cmd.split(/\s/)[0], args, spawnOptions) as RunResult; // For compat with cross-spawn - result.status = result.code; + result.status = result.exitCode; if (result.status !== 0) { const message = ` diff --git a/e2e/runJest.ts b/e2e/runJest.ts index 2591425854df..bbe6e38ecb03 100644 --- a/e2e/runJest.ts +++ b/e2e/runJest.ts @@ -9,7 +9,7 @@ import * as path from 'path'; import * as fs from 'fs'; import {Writable} from 'stream'; -import execa, {ExecaChildProcess, ExecaReturns} from 'execa'; +import execa, {ExecaChildProcess, ExecaReturnValue} from 'execa'; import stripAnsi from 'strip-ansi'; import {normalizeIcons} from './Utils'; @@ -53,7 +53,7 @@ function spawnJest( args?: Array, options: RunJestOptions = {}, spawnAsync: boolean = false, -): ExecaReturns | ExecaChildProcess { +): ExecaReturnValue | ExecaChildProcess { const isRelative = !path.isAbsolute(dir); if (isRelative) { @@ -103,7 +103,7 @@ type RunJestResult = ExecaReturns & { function normalizeResult(result: RunJestResult, options: RunJestOptions) { // For compat with cross-spawn - result.status = result.code; + result.status = result.exitCode; result.stdout = normalizeIcons(result.stdout); if (options.stripAnsi) result.stdout = stripAnsi(result.stdout); diff --git a/packages/jest-circus/src/__mocks__/testUtils.ts b/packages/jest-circus/src/__mocks__/testUtils.ts index 12c2da24e110..6e0e5a434e92 100644 --- a/packages/jest-circus/src/__mocks__/testUtils.ts +++ b/packages/jest-circus/src/__mocks__/testUtils.ts @@ -9,7 +9,7 @@ import * as fs from 'fs'; import {tmpdir} from 'os'; import * as path from 'path'; import {createHash} from 'crypto'; -import {ExecaReturns, sync as spawnSync} from 'execa'; +import {ExecaSyncReturnValue, sync as spawnSync} from 'execa'; import {skipSuiteOnWindows} from '@jest/test-utils'; const CIRCUS_PATH = require.resolve('../../build'); @@ -20,7 +20,7 @@ const BABEL_REGISTER_PATH = require.resolve('@babel/register'); skipSuiteOnWindows(); -interface Result extends ExecaReturns { +interface Result extends ExecaSyncReturnValue { status: number; error: string; } @@ -58,7 +58,7 @@ export const runTest = (source: string) => { }) as Result; // For compat with cross-spawn - result.status = result.code; + result.status = result.exitCode; if (result.status !== 0) { const message = `