1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var path = require('path');
|
8 |
|
9 | module.exports = function(tests, partialFilename) {
|
10 | if (!partialFilename) {
|
11 | console.log('No partial filename supplied to group filter, using all tests');
|
12 | return tests;
|
13 | }
|
14 |
|
15 | if (typeof partialFilename === 'string') {
|
16 | partialFilename = [partialFilename];
|
17 | }
|
18 |
|
19 | console.log("Using group filter: ", partialFilename);
|
20 | return tests.filter(function(t) {
|
21 | return path.extname(t.filename) === '.js';
|
22 | }).filter(function(t) {
|
23 | return partialFilename.some(function(pfn) {
|
24 | return t.filename.indexOf(pfn) !== -1;
|
25 | });
|
26 | });
|
27 | };
|