find-cypress-specs 1.34.6 → 1.35.1
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.
- package/README.md +8 -0
- package/package.json +3 -2
- package/src/index.js +16 -1
package/README.md
CHANGED
|
@@ -292,6 +292,14 @@ See example in [bahmutov/test-todomvc-using-app-actions](https://github.com/bahm
|
|
|
292
292
|
|
|
293
293
|
**Tip:** read my blog post [Convert Cypress Specs from JavaScript to TypeScript](https://glebbahmutov.com/blog/cypress-js-to-ts/).
|
|
294
294
|
|
|
295
|
+
## Custom config filename
|
|
296
|
+
|
|
297
|
+
If you want to use a custom Cypress config, pass it via the environment variable `CYPRESS_CONFIG_FILE`
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
$ CYPRESS_CONFIG_FILE=path/to/cypress.config.js npx find-cypres-specs ...
|
|
301
|
+
```
|
|
302
|
+
|
|
295
303
|
## Details
|
|
296
304
|
|
|
297
305
|
Cypress uses the resolved [configuration values](https://on.cypress.io/configuration) to find the spec files to run. It searches the `integrationFolder` for all patterns listed in `testFiles` and removes any files matching the `ignoreTestFiles` patterns.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.1",
|
|
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",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"pluralize": "^8.0.0",
|
|
72
73
|
"require-and-forget": "^1.0.1",
|
|
73
74
|
"shelljs": "^0.8.5",
|
|
74
|
-
"spec-change": "^1.
|
|
75
|
+
"spec-change": "^1.7.1",
|
|
75
76
|
"ts-node": "^10.9.1"
|
|
76
77
|
}
|
|
77
78
|
}
|
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('
|
|
84
|
+
throw new Error('Config file should be .ts, .js or .json file')
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
function findCypressSpecsV9(opts = {}) {
|