fix(striker-ui): add regex exclude input tests

main
Tsu-ba-me 2 years ago
parent 84d63076bb
commit 25c3b467f9
  1. 13
      striker-ui/lib/test_input/testInput.ts
  2. 1
      striker-ui/types/TestInputFunction.ts

@ -44,12 +44,15 @@ const evalIsIgnoreOnCallbacks = ({
const testInput: TestInputFunction = ({
excludeTestIds = [],
excludeTestIdsRe,
inputs = {},
isContinueOnFailure,
isIgnoreOnCallbacks: isIgnoreAllOnCallbacks,
isTestAll = Object.keys(inputs).length === 0,
tests = {},
} = {}): boolean => {
const allExcludeIds = [...excludeTestIds];
let testsToRun: InputTestInputs = {};
let allResult = true;
@ -61,7 +64,15 @@ const testInput: TestInputFunction = ({
testsToRun = { ...testsToRun, ...inputs };
excludeTestIds.forEach((id: string) => {
if (excludeTestIdsRe) {
Object.keys(testsToRun).forEach((id: string) => {
if (excludeTestIdsRe.test(id)) {
allExcludeIds.push(id);
}
});
}
allExcludeIds.forEach((id: string) => {
delete testsToRun[id];
});

@ -66,6 +66,7 @@ export type InputTestBatches = {
export type TestInputFunctionOptions = {
excludeTestIds?: string[];
excludeTestIdsRe?: RegExp;
inputs?: InputTestInputs;
isContinueOnFailure?: boolean;
isIgnoreOnCallbacks?: boolean;

Loading…
Cancel
Save