make ErrorMatcher an object rather than a tuple

This commit is contained in:
Nick Fyson 2020-09-11 18:30:07 +01:00
parent 1fb7c81099
commit b3b99014eb
12 changed files with 58 additions and 48 deletions

View file

@ -21,8 +21,8 @@ function testErrorMatcher(matcherName: string, logSample: string): boolean {
if (!(matcherName in namedMatchersForTesting)) {
throw new Error(`Unknown matcher ${matcherName}`);
}
const regex = namedMatchersForTesting[matcherName][1];
if (regex === null) {
const regex = namedMatchersForTesting[matcherName].outputRegex;
if (regex === undefined) {
throw new Error(`Cannot test matcher ${matcherName} with null regex`);
}
return regex.test(logSample);