mirror of
https://github.com/github/codeql-action.git
synced 2026-05-08 14:50:21 +00:00
add missing error case for exit code matching
This commit is contained in:
Generated
+25
@@ -23,6 +23,31 @@ ava_1.default("matchers are never applied if non-error exit", async (t) => {
|
||||
t.deepEqual(await exec.exec("node", testArgs), 0);
|
||||
t.deepEqual(await toolrunner_error_catcher_1.toolrunnerErrorCatcher("node", testArgs, matchers), 0);
|
||||
});
|
||||
ava_1.default("exit code matching is correctly handled", async (t) => {
|
||||
const testArgs = buildDummyArgs("foo bar\\nblort qux", "foo bar\\nblort qux", "", 42);
|
||||
const nonMatchers = [
|
||||
{
|
||||
exitCode: 123,
|
||||
outputRegex: new RegExp("will not match"),
|
||||
message: "custom message!",
|
||||
},
|
||||
];
|
||||
await t.throwsAsync(toolrunner_error_catcher_1.toolrunnerErrorCatcher("node", testArgs, nonMatchers), {
|
||||
instanceOf: Error,
|
||||
message: "The process 'node' failed with exit code 42",
|
||||
});
|
||||
const matchers = [
|
||||
{
|
||||
exitCode: 42,
|
||||
outputRegex: new RegExp("will not match"),
|
||||
message: "custom message!",
|
||||
},
|
||||
];
|
||||
await t.throwsAsync(toolrunner_error_catcher_1.toolrunnerErrorCatcher("node", testArgs, matchers), {
|
||||
instanceOf: Error,
|
||||
message: "custom message!",
|
||||
});
|
||||
});
|
||||
ava_1.default("regex matchers are applied to stdout for non-zero exit code", async (t) => {
|
||||
const testArgs = buildDummyArgs("foo bar\\nblort qux", "", "", 1);
|
||||
const matchers = [
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user