find-cypress-specs 1.30.1 → 1.30.2
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 -1
- package/package.json +2 -2
- package/src/index.js +14 -8
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
|
|
|
@@ -159,6 +159,7 @@ $ npx find-cypress-specs --names --tagged <tag1>,<tag2>,<tag3>,...
|
|
|
159
159
|
# finds all specs and tests, then filters the output showing all tests
|
|
160
160
|
# tagged with tag1 or tag2 or tag3 or ...
|
|
161
161
|
```
|
|
162
|
+
|
|
162
163
|
## File names filtered by a tag
|
|
163
164
|
|
|
164
165
|
```
|
|
@@ -257,6 +258,12 @@ Finding tests in the individual specs uses [find-test-names](https://github.com/
|
|
|
257
258
|
$ DEBUG=find-cypress-specs,find-test-names npx find-cypress-specs --names
|
|
258
259
|
```
|
|
259
260
|
|
|
261
|
+
To debug finding changed specs against a branch, use `find-cypress-specs:git`
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
$ DEBUG=find-cypress-specs:git npx find-cypress-specs --branch main
|
|
265
|
+
```
|
|
266
|
+
|
|
260
267
|
## Videos
|
|
261
268
|
|
|
262
269
|
- [Use Ava Snapshots And Execa-wrap To Write End-to-End Tests For CLI Utilities](https://youtu.be/rsw17RqP0G0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.2",
|
|
4
4
|
"description": "Find Cypress spec files using the config settings",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"files": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"homepage": "https://github.com/bahmutov/find-cypress-specs#readme",
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"ava": "^4.0.0",
|
|
50
|
-
"cypress": "12.
|
|
50
|
+
"cypress": "12.8.0",
|
|
51
51
|
"execa-wrap": "^1.4.0",
|
|
52
52
|
"prettier": "^2.5.1",
|
|
53
53
|
"really-need": "^1.9.2",
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ const { getTestNames, countTags } = require('find-test-names')
|
|
|
3
3
|
const { pickTaggedTestsFrom, leavePendingTestsOnly } = require('../src/tagged')
|
|
4
4
|
|
|
5
5
|
const debug = require('debug')('find-cypress-specs')
|
|
6
|
+
const debugGit = require('debug')('find-cypress-specs:git')
|
|
6
7
|
const fs = require('fs')
|
|
7
8
|
const path = require('path')
|
|
8
9
|
const globby = require('globby')
|
|
@@ -294,25 +295,25 @@ function findChangedFiles(branch, useParent) {
|
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
// can we find updated and added files?
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
debugGit('finding changed files against %s', branch)
|
|
299
|
+
debugGit('using parent?', useParent)
|
|
299
300
|
|
|
300
301
|
if (useParent) {
|
|
301
302
|
let result = shell.exec(`git merge-base origin/${branch} HEAD`, {
|
|
302
303
|
silent: true,
|
|
303
304
|
})
|
|
304
305
|
if (result.code !== 0) {
|
|
305
|
-
|
|
306
|
+
debugGit('git failed to find merge base with the branch %s', branch)
|
|
306
307
|
return []
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
const commit = result.stdout.trim()
|
|
310
|
-
|
|
311
|
+
debugGit('merge commit with branch "%s" is %s', branch, commit)
|
|
311
312
|
result = shell.exec(`git diff --name-only --diff-filter=AMR ${commit}..`, {
|
|
312
313
|
silent: true,
|
|
313
314
|
})
|
|
314
315
|
if (result.code !== 0) {
|
|
315
|
-
|
|
316
|
+
debugGit('git diff failed with code %d', result.code)
|
|
316
317
|
return []
|
|
317
318
|
}
|
|
318
319
|
|
|
@@ -320,14 +321,19 @@ function findChangedFiles(branch, useParent) {
|
|
|
320
321
|
.split('\n')
|
|
321
322
|
.map((s) => s.trim())
|
|
322
323
|
.filter(Boolean)
|
|
324
|
+
debugGit(
|
|
325
|
+
'found %d changed files against branch %s',
|
|
326
|
+
filenames.length,
|
|
327
|
+
branch,
|
|
328
|
+
)
|
|
323
329
|
return filenames
|
|
324
330
|
} else {
|
|
325
331
|
const command = `git diff --name-only --diff-filter=AMR origin/${branch}`
|
|
326
|
-
|
|
332
|
+
debugGit('command: %s', command)
|
|
327
333
|
|
|
328
334
|
const result = shell.exec(command, { silent: true })
|
|
329
335
|
if (result.code !== 0) {
|
|
330
|
-
|
|
336
|
+
debugGit('git diff failed with code %d', result.code)
|
|
331
337
|
return []
|
|
332
338
|
}
|
|
333
339
|
|
|
@@ -335,7 +341,7 @@ function findChangedFiles(branch, useParent) {
|
|
|
335
341
|
.split('\n')
|
|
336
342
|
.map((s) => s.trim())
|
|
337
343
|
.filter(Boolean)
|
|
338
|
-
|
|
344
|
+
debugGit(
|
|
339
345
|
'found %d changed %s',
|
|
340
346
|
filenames.length,
|
|
341
347
|
pluralize('file', filenames.length),
|