1 | var _ = require("lodash");
|
2 |
|
3 | module.exports = function(tests, tags) {
|
4 |
|
5 | if (typeof tags === "string") {
|
6 | tags = tags.split(',').map(_.method('trim'));
|
7 | }
|
8 |
|
9 |
|
10 | if (!_.isArray(tags) || tags.length === 0) {
|
11 | console.log("Mocha tag filter input tags are empty, returning all tests.");
|
12 | return tests;
|
13 | }
|
14 |
|
15 | console.log("Using mocha tag filter with tags: ", tags);
|
16 | return tests.filter(function(test) {
|
17 | return tags.every(function(wantedTag) {
|
18 | return test.name.indexOf('@' + wantedTag) > -1;
|
19 | })
|
20 | });
|
21 | };
|