From 25c3b467f95e2a90acd76c093c4758bf0a75bbee Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 19 Aug 2022 19:33:59 -0400 Subject: [PATCH] fix(striker-ui): add regex exclude input tests --- striker-ui/lib/test_input/testInput.ts | 13 ++++++++++++- striker-ui/types/TestInputFunction.ts | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/striker-ui/lib/test_input/testInput.ts b/striker-ui/lib/test_input/testInput.ts index 5b9cd8cf..27ee07c7 100644 --- a/striker-ui/lib/test_input/testInput.ts +++ b/striker-ui/lib/test_input/testInput.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]; }); diff --git a/striker-ui/types/TestInputFunction.ts b/striker-ui/types/TestInputFunction.ts index 70231439..3c23d9a0 100644 --- a/striker-ui/types/TestInputFunction.ts +++ b/striker-ui/types/TestInputFunction.ts @@ -66,6 +66,7 @@ export type InputTestBatches = { export type TestInputFunctionOptions = { excludeTestIds?: string[]; + excludeTestIdsRe?: RegExp; inputs?: InputTestInputs; isContinueOnFailure?: boolean; isIgnoreOnCallbacks?: boolean;