find-cypress-specs 1.34.6 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/src/index.js +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.34.6",
3
+ "version": "1.35.0",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -18,6 +18,7 @@
18
18
  "demo-names": "DEBUG=find-cypress-specs node ./bin/find --names",
19
19
  "demo-skipped-tests": "DEBUG=find-cypress-specs node ./bin/find --names --skipped",
20
20
  "demo-count-skipped-tests": "DEBUG=find-cypress-specs node ./bin/find --names --skipped --count",
21
+ "demo-custom-cypress-config": "DEBUG=find-cypress-specs CYPRESS_CONFIG_FILE=test-ts/cypress.config.custom.ts node ./bin/find",
21
22
  "demo-tags": "node ./bin/find --tags",
22
23
  "demo-tags-json": "node ./bin/find --tags --json",
23
24
  "demo-names-and-tags": "node ./bin/find --names --tags",
package/src/index.js CHANGED
@@ -51,6 +51,21 @@ function getConfigTs(filename) {
51
51
  }
52
52
 
53
53
  function getConfig() {
54
+ if (typeof process.env.CYPRESS_CONFIG_FILE !== 'undefined') {
55
+ const configFile = process.env.CYPRESS_CONFIG_FILE
56
+ if (configFile.endsWith('.js')) {
57
+ debug(`found file ${configFile}`);
58
+ return getConfigJs(`./${configFile}`)
59
+ } else if (configFile.endsWith('.ts')) {
60
+ debug(`found file ${configFile}`);
61
+ return getConfigTs(`./${configFile}`)
62
+ } else if (configFile.endsWith('.json')) {
63
+ debug(`found file ${configFile}`);
64
+ return getConfigJson(`./${configFile}`)
65
+ }
66
+ throw new Error('Config file should be .ts, .js or .json file even when using CYPRESS_CONFIG_FILE env var')
67
+ }
68
+
54
69
  if (fs.existsSync('./cypress.config.js')) {
55
70
  debug('found file cypress.config.js')
56
71
  return getConfigJs('./cypress.config.js')
@@ -66,7 +81,7 @@ function getConfig() {
66
81
  return getConfigJson('./cypress.json')
67
82
  }
68
83
 
69
- throw new Error('Do not know how to find and load Cypress config file')
84
+ throw new Error('Config file should be .ts, .js or .json file')
70
85
  }
71
86
 
72
87
  function findCypressSpecsV9(opts = {}) {