find-cypress-specs 1.41.4 → 1.42.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 +2 -2
- package/package.json +4 -4
- package/src/index.js +11 -9
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
|
|
|
@@ -290,7 +290,7 @@ $ npx find-cypress-specs --names --skipped --count
|
|
|
290
290
|
|
|
291
291
|
## cypress.config.ts
|
|
292
292
|
|
|
293
|
-
If the project uses TypeScript and `cypress.config.ts` then this module uses [
|
|
293
|
+
If the project uses TypeScript and `cypress.config.ts` then this module uses [tsx](https://github.com/privatenumber/tsx) to load the config and fetch the spec pattern.
|
|
294
294
|
|
|
295
295
|
If you are using `import` keyword in your `cypress.config.ts` you might get an error like this:
|
|
296
296
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "Find Cypress spec files using the config settings",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"files": [
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"homepage": "https://github.com/bahmutov/find-cypress-specs#readme",
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"ava": "^4.0.0",
|
|
58
|
-
"cypress": "13.6.
|
|
58
|
+
"cypress": "13.6.4",
|
|
59
59
|
"dependency-version-badge": "^1.11.0",
|
|
60
60
|
"execa-wrap": "^1.4.0",
|
|
61
61
|
"prettier": "^2.5.1",
|
|
62
62
|
"really-need": "^1.9.2",
|
|
63
|
-
"semantic-release": "23.0.
|
|
63
|
+
"semantic-release": "23.0.2",
|
|
64
64
|
"sinon": "^13.0.1",
|
|
65
65
|
"typescript": "^4.6.3"
|
|
66
66
|
},
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"require-and-forget": "^1.0.1",
|
|
77
77
|
"shelljs": "^0.8.5",
|
|
78
78
|
"spec-change": "^1.10.0",
|
|
79
|
-
"
|
|
79
|
+
"tsx": "^4.7.1"
|
|
80
80
|
}
|
|
81
81
|
}
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,12 @@ const shell = require('shelljs')
|
|
|
12
12
|
const pluralize = require('pluralize')
|
|
13
13
|
const requireEveryTime = require('require-and-forget')
|
|
14
14
|
|
|
15
|
+
// Require CJS loader to resolve:
|
|
16
|
+
// https://github.com/bahmutov/find-cypress-specs/issues/228
|
|
17
|
+
// https://github.com/bahmutov/find-cypress-specs/issues/222
|
|
18
|
+
// https://github.com/privatenumber/tsx
|
|
19
|
+
require('tsx/cjs')
|
|
20
|
+
|
|
15
21
|
const MINIMATCH_OPTIONS = { dot: true, matchBase: true }
|
|
16
22
|
|
|
17
23
|
/**
|
|
@@ -37,15 +43,6 @@ function getConfigJs(filename) {
|
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
function getConfigTs(filename) {
|
|
40
|
-
// handle ts modules without "type: module"
|
|
41
|
-
// https://github.com/bahmutov/find-cypress-specs/issues/222
|
|
42
|
-
const tsNode = require('ts-node')
|
|
43
|
-
tsNode.register({
|
|
44
|
-
transpileOnly: true,
|
|
45
|
-
compilerOptions: {
|
|
46
|
-
module: 'commonjs',
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
46
|
const configFilename = path.join(process.cwd(), filename)
|
|
50
47
|
debug('loading Cypress config from %s', configFilename)
|
|
51
48
|
const definedConfig = requireEveryTime(configFilename)
|
|
@@ -146,8 +143,13 @@ function findCypressSpecsV10(opts = {}, type = 'e2e', returnAbsolute = false) {
|
|
|
146
143
|
if (type !== 'e2e' && type !== 'component') {
|
|
147
144
|
throw new Error(`Unknown spec type ${type}`)
|
|
148
145
|
}
|
|
146
|
+
// handle the interoperability loading of default export
|
|
147
|
+
if (Object.keys(opts).length === 1 && Object.keys(opts)[0] === 'default') {
|
|
148
|
+
opts = opts.default
|
|
149
|
+
}
|
|
149
150
|
|
|
150
151
|
if (!(type in opts)) {
|
|
152
|
+
debug('options %o', opts)
|
|
151
153
|
throw new Error(`Missing "${type}" object in the Cypress config object`)
|
|
152
154
|
}
|
|
153
155
|
const e2eDefaults = {
|