renames to reflect the switch to using toolrunner
This commit is contained in:
parent
3cd41279f2
commit
88951d6193
11 changed files with 36 additions and 36 deletions
|
|
@ -12,9 +12,9 @@ import uuidV4 from 'uuid/v4';
|
|||
import * as api from './api-client';
|
||||
import * as defaults from './defaults.json'; // Referenced from codeql-action-sync-tool!
|
||||
import { errorMatchers} from './error-matcher';
|
||||
import { execErrorCatcher } from './exec-wrapper';
|
||||
import { Language } from './languages';
|
||||
import { Logger } from './logging';
|
||||
import { toolrunnerErrorCatcher } from './toolrunner-error-catcher';
|
||||
import * as util from './util';
|
||||
|
||||
type Options = (string|number|boolean)[];
|
||||
|
|
@ -425,7 +425,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
const traceCommand = path.resolve(JSON.parse(extractorPath), 'tools', 'autobuild' + ext);
|
||||
|
||||
// Run trace command
|
||||
await execErrorCatcher(
|
||||
await toolrunnerErrorCatcher(
|
||||
cmd, [
|
||||
'database',
|
||||
'trace-command',
|
||||
|
|
@ -438,7 +438,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
);
|
||||
},
|
||||
finalizeDatabase: async function(databasePath: string) {
|
||||
await execErrorCatcher(
|
||||
await toolrunnerErrorCatcher(
|
||||
cmd, [
|
||||
'database',
|
||||
'finalize',
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import * as toolrunnner from '@actions/exec/lib/toolrunner';
|
|||
import test from 'ava';
|
||||
|
||||
import { ErrorMatcher } from './error-matcher';
|
||||
import { execErrorCatcher } from './exec-wrapper';
|
||||
import {setupTests} from './testing-utils';
|
||||
import { toolrunnerErrorCatcher } from './toolrunner-error-catcher';
|
||||
|
||||
setupTests(test);
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ test('matchers are never applied if non-error exit', async t => {
|
|||
|
||||
t.deepEqual(await exec.exec('node', testArgs), 0);
|
||||
|
||||
t.deepEqual(await execErrorCatcher('node', testArgs, matchers), 0);
|
||||
t.deepEqual(await toolrunnerErrorCatcher('node', testArgs, matchers), 0);
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ test('regex matchers are applied to stdout for non-zero exit code', async t => {
|
|||
await t.throwsAsync(exec.exec('node', testArgs), {instanceOf: Error, message: 'The process \'node\' failed with exit code 1'});
|
||||
|
||||
await t.throwsAsync(
|
||||
execErrorCatcher('node', testArgs, matchers),
|
||||
toolrunnerErrorCatcher('node', testArgs, matchers),
|
||||
{instanceOf: Error, message: '🦄'}
|
||||
);
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ test('regex matchers are applied to stderr for non-zero exit code', async t => {
|
|||
await t.throwsAsync(exec.exec('node', testArgs), {instanceOf: Error, message: 'The process \'node\' failed with exit code 1'});
|
||||
|
||||
await t.throwsAsync(
|
||||
execErrorCatcher('node', testArgs, matchers),
|
||||
toolrunnerErrorCatcher('node', testArgs, matchers),
|
||||
{instanceOf: Error, message: '🦄'}
|
||||
);
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ test('matcher returns correct error message when multiple matchers defined', asy
|
|||
await t.throwsAsync(exec.exec('node', testArgs), {instanceOf: Error, message: 'The process \'node\' failed with exit code 1'});
|
||||
|
||||
await t.throwsAsync(
|
||||
execErrorCatcher('node', testArgs, matchers),
|
||||
toolrunnerErrorCatcher('node', testArgs, matchers),
|
||||
{instanceOf: Error, message: '🦄'}
|
||||
);
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ test('matcher returns first match to regex when multiple matches', async t => {
|
|||
await t.throwsAsync(exec.exec('node', testArgs), {instanceOf: Error, message: 'The process \'node\' failed with exit code 1'});
|
||||
|
||||
await t.throwsAsync(
|
||||
execErrorCatcher('node', testArgs, matchers),
|
||||
toolrunnerErrorCatcher('node', testArgs, matchers),
|
||||
{instanceOf: Error, message: '🦄'}
|
||||
);
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ test('exit code matchers are applied', async t => {
|
|||
await t.throwsAsync(exec.exec('node', testArgs), {instanceOf: Error, message: 'The process \'node\' failed with exit code 123'});
|
||||
|
||||
await t.throwsAsync(
|
||||
execErrorCatcher('node', testArgs, matchers),
|
||||
toolrunnerErrorCatcher('node', testArgs, matchers),
|
||||
{instanceOf: Error, message: '🦄'}
|
||||
);
|
||||
|
||||
|
|
@ -102,9 +102,9 @@ test('exit code matchers are applied', async t => {
|
|||
test('execErrorCatcher respects the ignoreReturnValue option', async t => {
|
||||
const testArgs = buildDummyArgs("standard output", 'error output', '', 199);
|
||||
|
||||
await t.throwsAsync(execErrorCatcher('node', testArgs, [], {ignoreReturnCode: false}), {instanceOf: Error});
|
||||
await t.throwsAsync(toolrunnerErrorCatcher('node', testArgs, [], {ignoreReturnCode: false}), {instanceOf: Error});
|
||||
|
||||
t.deepEqual(await execErrorCatcher('node', testArgs, [], {ignoreReturnCode: true}), 199);
|
||||
t.deepEqual(await toolrunnerErrorCatcher('node', testArgs, [], {ignoreReturnCode: true}), 199);
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ test('execErrorCatcher preserves behavior of provided listeners', async t => {
|
|||
|
||||
const testArgs = buildDummyArgs(stdoutExpected, stderrExpected, '', 0);
|
||||
|
||||
t.deepEqual(await execErrorCatcher('node', testArgs, [], {listeners: listeners}), 0);
|
||||
t.deepEqual(await toolrunnerErrorCatcher('node', testArgs, [], {listeners: listeners}), 0);
|
||||
|
||||
t.deepEqual(stdoutActual, stdoutExpected + "\n");
|
||||
t.deepEqual(stderrActual, stderrExpected + "\n");
|
||||
|
|
@ -14,9 +14,9 @@ import {ErrorMatcher} from './error-matcher';
|
|||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
export async function execErrorCatcher(commandLine: string, args?: string[],
|
||||
matchers?: ErrorMatcher[],
|
||||
options?: im.ExecOptions): Promise<number> {
|
||||
export async function toolrunnerErrorCatcher(commandLine: string, args?: string[],
|
||||
matchers?: ErrorMatcher[],
|
||||
options?: im.ExecOptions): Promise<number> {
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
Loading…
Add table
Add a link
Reference in a new issue