Skip to content

Commit

Permalink
Omit outputting filtered pickles
Browse files Browse the repository at this point in the history
These won't have any associated test case in the message report.
  • Loading branch information
badeball committed Jun 23, 2024
1 parent b3a9174 commit f343cc3
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions lib/browser-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,56 +1086,56 @@ export default function createTests(

const testStepIds: TestStepIds = new Map();

const testCases: messages.TestCase[] = pickles
.filter((pickle) => {
return !omitFiltered || !shouldSkipPickle(testFilter, pickle);
})
.map((pickle) => {
const tags = collectTagNames(pickle.tags);
const beforeHooks = registry.resolveBeforeHooks(tags);
const afterHooks = registry.resolveAfterHooks(tags);

const hooksToStep = (hook: ICaseHook): messages.TestStep => {
return {
id: createTestStepId({
testStepIds,
newId,
pickleId: pickle.id,
hookIdOrPickleStepId: hook.id,
}),
hookId: hook.id,
};
};
const includedPickles = pickles.filter((pickle) => {
return !omitFiltered || !shouldSkipPickle(testFilter, pickle);
});

const pickleStepToTestStep = (
pickleStep: messages.PickleStep
): messages.TestStep => {
const stepDefinitionIds = registry
.getMatchingStepDefinitions(pickleStep.text)
.map((stepDefinition) => stepDefinition.id);

return {
id: createTestStepId({
testStepIds,
newId,
pickleId: pickle.id,
hookIdOrPickleStepId: pickleStep.id,
}),
pickleStepId: pickleStep.id,
stepDefinitionIds,
};
const testCases: messages.TestCase[] = includedPickles.map((pickle) => {
const tags = collectTagNames(pickle.tags);
const beforeHooks = registry.resolveBeforeHooks(tags);
const afterHooks = registry.resolveAfterHooks(tags);

const hooksToStep = (hook: ICaseHook): messages.TestStep => {
return {
id: createTestStepId({
testStepIds,
newId,
pickleId: pickle.id,
hookIdOrPickleStepId: hook.id,
}),
hookId: hook.id,
};
};

const pickleStepToTestStep = (
pickleStep: messages.PickleStep
): messages.TestStep => {
const stepDefinitionIds = registry
.getMatchingStepDefinitions(pickleStep.text)
.map((stepDefinition) => stepDefinition.id);

return {
id: pickle.id,
pickleId: pickle.id,
testSteps: [
...beforeHooks.map(hooksToStep),
...pickle.steps.map(pickleStepToTestStep),
...afterHooks.map(hooksToStep),
],
id: createTestStepId({
testStepIds,
newId,
pickleId: pickle.id,
hookIdOrPickleStepId: pickleStep.id,
}),
pickleStepId: pickleStep.id,
stepDefinitionIds,
};
});
};

return {
id: pickle.id,
pickleId: pickle.id,
testSteps: [
...beforeHooks.map(hooksToStep),
...pickle.steps.map(pickleStepToTestStep),
...afterHooks.map(hooksToStep),
],
};
});

const specEnvelopes: messages.Envelope[] = [];

Expand All @@ -1154,7 +1154,7 @@ export default function createTests(
gherkinDocument,
});

for (const pickle of pickles) {
for (const pickle of includedPickles) {
specEnvelopes.push({
pickle,
});
Expand Down

0 comments on commit f343cc3

Please sign in to comment.