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 = ({ const testInput: TestInputFunction = ({
excludeTestIds = [], excludeTestIds = [],
excludeTestIdsRe,
inputs = {}, inputs = {},
isContinueOnFailure, isContinueOnFailure,
isIgnoreOnCallbacks: isIgnoreAllOnCallbacks, isIgnoreOnCallbacks: isIgnoreAllOnCallbacks,
isTestAll = Object.keys(inputs).length === 0, isTestAll = Object.keys(inputs).length === 0,
tests = {}, tests = {},
} = {}): boolean => { } = {}): boolean => {
const allExcludeIds = [...excludeTestIds];
let testsToRun: InputTestInputs = {}; let testsToRun: InputTestInputs = {};
let allResult = true; let allResult = true;
@ -61,7 +64,15 @@ const testInput: TestInputFunction = ({
testsToRun = { ...testsToRun, ...inputs }; 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]; delete testsToRun[id];
}); });

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

Loading…
Cancel
Save