find-cypress-specs 1.19.0 → 1.19.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 +23 -0
- package/package.json +1 -1
- package/src/index.js +4 -4
package/README.md
CHANGED
|
@@ -119,6 +119,29 @@ $ npx find-cypress-specs --names --tagged <tag1>,<tag2>,<tag3>,...
|
|
|
119
119
|
|
|
120
120
|
If the project uses TypeScript and `cypress.config.ts` then this module uses [ts-node/register](https://github.com/TypeStrong/ts-node) to load the config and fetch the spec pattern.
|
|
121
121
|
|
|
122
|
+
If you are using `import` keyword in your `cypress.config.ts` you might get an error like this:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
import { defineConfig } from 'cypress';
|
|
126
|
+
^^^^^^
|
|
127
|
+
|
|
128
|
+
SyntaxError: Cannot use import statement outside a module
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
In that case, add to your `tsconfig.json` file the `ts-node` block:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"ts-node": {
|
|
136
|
+
"compilerOptions": {
|
|
137
|
+
"module": "commonjs"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
See example in [bahmutov/test-todomvc-using-app-actions](https://github.com/bahmutov/test-todomvc-using-app-actions).
|
|
144
|
+
|
|
122
145
|
**Tip:** read my blog post [Convert Cypress Specs from JavaScript to TypeScript](https://glebbahmutov.com/blog/cypress-js-to-ts/).
|
|
123
146
|
|
|
124
147
|
## Details
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -32,10 +32,10 @@ function getConfigJs(filename) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function getConfigTs(filename) {
|
|
35
|
-
require('ts-node/register')
|
|
36
|
-
const
|
|
37
|
-
debug('loading Cypress config from %s',
|
|
38
|
-
const definedConfig = requireEveryTime(
|
|
35
|
+
require('ts-node/register/transpile-only')
|
|
36
|
+
const configFilename = path.join(process.cwd(), filename)
|
|
37
|
+
debug('loading Cypress config from %s', configFilename)
|
|
38
|
+
const definedConfig = requireEveryTime(configFilename)
|
|
39
39
|
return definedConfig
|
|
40
40
|
}
|
|
41
41
|
|