find-cypress-specs 1.24.0 → 1.25.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.
Files changed (3) hide show
  1. package/README.md +33 -1
  2. package/bin/find.js +14 -5
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # find-cypress-specs [![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-12.2.0-brightgreen) [![ci](https://github.com/bahmutov/find-cypress-specs/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/find-cypress-specs/actions/workflows/ci.yml)
1
+ # find-cypress-specs [![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-12.3.0-brightgreen) [![ci](https://github.com/bahmutov/find-cypress-specs/actions/workflows/ci.yml/badge.svg?branch=main)](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
 
@@ -167,6 +167,24 @@ cypress/e2e/featureA/user.cy.ts (1 test, 1 pending)
167
167
  found 1 spec (1 test, 1 pending)
168
168
  ```
169
169
 
170
+ ## Print skipped tests
171
+
172
+ ```
173
+ $ npx find-cypress-specs --names --skipped
174
+ ```
175
+
176
+ Prints each spec that has skipped tests.
177
+
178
+ ## Count skipped tests
179
+
180
+ Prints the single number with the count of skipped tests
181
+
182
+ ```
183
+ $ npx find-cypress-specs --names --skipped --count
184
+
185
+ 5
186
+ ```
187
+
170
188
  ## cypress.config.ts
171
189
 
172
190
  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.
@@ -212,8 +230,22 @@ Run the utility with environment variable `DEBUG=find-cypress-specs` to see the
212
230
 
213
231
  ## Examples
214
232
 
233
+ - 📝 blog post [Run Changed Traced Specs On GitHub Actions](https://glebbahmutov.com/blog/trace-changed-specs/)
215
234
  - [chat.io](https://github.com/bahmutov/chat.io) as described in the blog post [Get Faster Feedback From Your Cypress Tests Running On CircleCI](https://glebbahmutov.com/blog/faster-ci-feedback-on-circleci/)
216
235
 
236
+ ## NPM module
237
+
238
+ You can use this module via its NPM module API.
239
+
240
+ ```js
241
+ const { getSpecs } = require('find-cypress-specs')
242
+ // somewhere in the cypress.config.js
243
+ setupNodeEvents(on, config) {
244
+ const specs = getSpecs(config)
245
+ // specs is a list of filenames
246
+ }
247
+ ```
248
+
217
249
  ## Small print
218
250
 
219
251
  Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2022
package/bin/find.js CHANGED
@@ -114,13 +114,22 @@ if (args['--names'] || args['--tags']) {
114
114
  addCounts(jsonResults)
115
115
  }
116
116
 
117
- if (args['--json']) {
118
- console.log(JSON.stringify(jsonResults, null, 2))
117
+ if (args['--count']) {
118
+ let n = 0
119
+ Object.keys(jsonResults).forEach((filename) => {
120
+ const skippedCount = jsonResults[filename].counts.pending
121
+ n += skippedCount
122
+ })
123
+ console.log(n)
119
124
  } else {
120
- const str = stringAllInfo(jsonResults)
121
- console.log(str)
125
+ if (args['--json']) {
126
+ console.log(JSON.stringify(jsonResults, null, 2))
127
+ } else {
128
+ const str = stringAllInfo(jsonResults)
129
+ console.log(str)
130
+ }
131
+ console.log('')
122
132
  }
123
- console.log('')
124
133
  }
125
134
 
126
135
  if (args['--tags']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.24.0",
3
+ "version": "1.25.1",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -16,6 +16,7 @@
16
16
  "demo": "DEBUG=find-cypress-specs node ./bin/find",
17
17
  "demo-names": "node ./bin/find --names",
18
18
  "demo-skipped-tests": "node ./bin/find --names --skipped",
19
+ "demo-count-skipped-tests": "node ./bin/find --names --skipped --count",
19
20
  "demo-tags": "node ./bin/find --tags",
20
21
  "demo-tags-json": "node ./bin/find --tags --json",
21
22
  "demo-names-and-tags": "node ./bin/find --names --tags",
@@ -43,11 +44,11 @@
43
44
  "homepage": "https://github.com/bahmutov/find-cypress-specs#readme",
44
45
  "devDependencies": {
45
46
  "ava": "^4.0.0",
46
- "cypress": "12.2.0",
47
+ "cypress": "12.3.0",
47
48
  "execa-wrap": "^1.4.0",
48
49
  "prettier": "^2.5.1",
49
50
  "really-need": "^1.9.2",
50
- "semantic-release": "19.0.5",
51
+ "semantic-release": "20.0.2",
51
52
  "sinon": "^13.0.1",
52
53
  "typescript": "^4.6.3"
53
54
  },
@@ -56,7 +57,7 @@
56
57
  "arg": "^5.0.1",
57
58
  "console.table": "^0.10.0",
58
59
  "debug": "^4.3.3",
59
- "find-test-names": "1.22.2",
60
+ "find-test-names": "1.23.0",
60
61
  "globby": "^11.0.4",
61
62
  "minimatch": "^3.0.4",
62
63
  "pluralize": "^8.0.0",