Skip to content

Commit

Permalink
Keep the parameter 'tags' as an array in the body of the function (#337)
Browse files Browse the repository at this point in the history
Previously, we were transforming it into a set. This was giving problems
in a later condition, so that no message/debugInfo were defined, and the
user would get an alert with the message "undefined".

Now the set stays local to the code block where it's used, so that the
parameter variable "tags" is an array for the whole function, for more
consistency with the "names" variable.
  • Loading branch information
julienw authored Nov 29, 2023
1 parent 208e1ab commit 2414364
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions resources/tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Suites.enable = function (names, tags) {
if (!Tags.has(tag))
console.error(`Unknown Suites tag: "${tag}"`);
});
tags = new Set(tags);
const tagsSet = new Set(tags);
this.forEach((suite) => {
suite.disabled = !suite.tags.some((tag) => tags.has(tag));
suite.disabled = !suite.tags.some((tag) => tagsSet.has(tag));
});
} else {
console.warn("Neither names nor tags provided. Enabling all default suites.");
Expand All @@ -46,7 +46,6 @@ Suites.enable = function (names, tags) {
validNames: this.map((each) => each.name),
};
} else if (tags?.length) {
tags = Array.from(tags);
message = `Tags "${tags}" does not match any Suite. No tests to run.`;
debugInfo = {
providedTags: tags,
Expand Down

0 comments on commit 2414364

Please sign in to comment.