tweak in response to reviewer comments
This commit is contained in:
parent
88951d6193
commit
1fb7c81099
12 changed files with 40 additions and 52 deletions
16
lib/error-matcher.test.js
generated
16
lib/error-matcher.test.js
generated
|
|
@ -17,17 +17,13 @@ ava_1.default('noSourceCodeFound matches against example javascript output', asy
|
|||
`));
|
||||
});
|
||||
function testErrorMatcher(matcherName, logSample) {
|
||||
const regex = error_matcher_1.namedMatchersForTesting[matcherName] ? error_matcher_1.namedMatchersForTesting[matcherName][1] : null;
|
||||
if (regex) {
|
||||
return regex.test(logSample);
|
||||
if (!(matcherName in error_matcher_1.namedMatchersForTesting)) {
|
||||
throw new Error(`Unknown matcher ${matcherName}`);
|
||||
}
|
||||
else {
|
||||
if (error_matcher_1.namedMatchersForTesting[matcherName]) {
|
||||
throw new Error(`Cannot test matcher ${matcherName} with null regex`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown matcher ${matcherName}`);
|
||||
}
|
||||
const regex = error_matcher_1.namedMatchersForTesting[matcherName][1];
|
||||
if (regex === null) {
|
||||
throw new Error(`Cannot test matcher ${matcherName} with null regex`);
|
||||
}
|
||||
return regex.test(logSample);
|
||||
}
|
||||
//# sourceMappingURL=error-matcher.test.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue