Skip to content

Commit e62fe1c

Browse files
Dane Harnettlgandecki
authored andcommitted
feat(cypress-tags): allow a GLOB to be passed to cypress-tags to limit the spec files searched
#276
1 parent c6b4a78 commit e62fe1c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

cypress-tags.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,27 @@ const { execFileSync } = require("child_process");
77

88
const { shouldProceedCurrentStep } = require("./lib/tagsHelper");
99

10+
const debug = (message, ...rest) =>
11+
process.env.DEBUG
12+
? console.log(`DEBUG: ${message}`, rest.length ? rest : "")
13+
: null;
14+
1015
// TODO currently we only work with feature files in cypress/integration folder.
1116
// It should be easy to base this on the cypress.json configuration - we are happy to take a PR
1217
// here if you need this functionality!
18+
const defaultGlob = "cypress/integration/**/*.feature";
1319

14-
const paths = glob.sync("cypress/integration/**/*.feature");
20+
const specArg = process.argv.slice(2).find(arg => arg.indexOf("GLOB=") === 0);
1521

16-
const featuresToRun = [];
22+
const specGlob = specArg ? specArg.replace(/.*=/, "") : defaultGlob;
1723

18-
const debug = (message, ...rest) =>
19-
process.env.DEBUG
20-
? console.log(`DEBUG: ${message}`, rest.length ? rest : "")
21-
: null;
24+
if (specArg) {
25+
debug("Found glob", specGlob);
26+
}
27+
28+
const paths = glob.sync(specGlob);
29+
30+
const featuresToRun = [];
2231

2332
const found = process.argv.slice(2).find(arg => arg.indexOf("TAGS=") === 0);
2433

0 commit comments

Comments
 (0)