find-cypress-specs 1.34.5 → 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.
- package/README.md +1 -1
- package/package.json +4 -3
- package/src/index.js +29 -5
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# find-cypress-specs [![renovate-app badge][renovate-badge]][renovate-app]  [](https://github.com/bahmutov/find-cypress-specs/actions/workflows/ci.yml)
|
|
2
2
|
|
|
3
3
|
> Find Cypress spec files using the config settings
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.
|
|
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",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"homepage": "https://github.com/bahmutov/find-cypress-specs#readme",
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"ava": "^4.0.0",
|
|
54
|
-
"cypress": "12.
|
|
55
|
+
"cypress": "12.17.1",
|
|
55
56
|
"dependency-version-badge": "^1.11.0",
|
|
56
57
|
"execa-wrap": "^1.4.0",
|
|
57
58
|
"prettier": "^2.5.1",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"console.table": "^0.10.0",
|
|
67
68
|
"debug": "^4.3.3",
|
|
68
69
|
"find-test-names": "1.28.13",
|
|
69
|
-
"globby": "^11.0
|
|
70
|
+
"globby": "^11.1.0",
|
|
70
71
|
"minimatch": "^3.0.4",
|
|
71
72
|
"pluralize": "^8.0.0",
|
|
72
73
|
"require-and-forget": "^1.0.1",
|
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 = {}) {
|
|
@@ -115,6 +130,7 @@ function findCypressSpecsV9(opts = {}) {
|
|
|
115
130
|
}
|
|
116
131
|
|
|
117
132
|
function findCypressSpecsV10(opts = {}, type = 'e2e') {
|
|
133
|
+
debug('findCypressSpecsV10')
|
|
118
134
|
if (type !== 'e2e' && type !== 'component') {
|
|
119
135
|
throw new Error(`Unknown spec type ${type}`)
|
|
120
136
|
}
|
|
@@ -146,11 +162,19 @@ function findCypressSpecsV10(opts = {}, type = 'e2e') {
|
|
|
146
162
|
|
|
147
163
|
debug('options v10 %o', options)
|
|
148
164
|
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
const ignore = Array.isArray(options.excludeSpecPattern)
|
|
166
|
+
? options.excludeSpecPattern
|
|
167
|
+
: options.excludeSpecPattern
|
|
168
|
+
? [options.excludeSpecPattern]
|
|
169
|
+
: []
|
|
170
|
+
const globbyOptions = {
|
|
151
171
|
sort: true,
|
|
152
|
-
ignore
|
|
153
|
-
}
|
|
172
|
+
ignore,
|
|
173
|
+
}
|
|
174
|
+
debug('globby options %s %o', options.specPattern, globbyOptions)
|
|
175
|
+
|
|
176
|
+
/** @type string[] */
|
|
177
|
+
const files = globby.sync(options.specPattern, globbyOptions)
|
|
154
178
|
debug('found %d file(s) %o', files.length, files)
|
|
155
179
|
|
|
156
180
|
// go through the files again and eliminate files that match
|