find-cypress-specs 1.36.4 → 1.37.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 CHANGED
@@ -1,4 +1,4 @@
1
- # find-cypress-specs [![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-13.3.1-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-13.5.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
 
@@ -113,6 +113,14 @@ $ npx find-cypress-specs --branch main --tagged @user,@preview
113
113
  # and that have any tests or suites inside tagged "@user" or "@preview"
114
114
  ```
115
115
 
116
+ You can set the list and number of specs with tags into GHA outputs
117
+
118
+ ```bash
119
+ $ npx find-cypress-specs --branch main --tagged @user,@preview --set-gha-outputs
120
+ ```
121
+
122
+ The number of found specs will be set as `taggedSpecsN` and the list will be set as `taggedSpecs`.
123
+
116
124
  ### count tagged changed specs
117
125
 
118
126
  Let's say we changed 2 specs that have tests tagged `@user`. We can output the count by adding `--count` option
@@ -192,10 +200,12 @@ $ npx find-cypress-specs --tagged <single tag>
192
200
  # cypress/e2e/spec.cy.js,cypress/e2e/featureA/user.cy.ts
193
201
  ```
194
202
 
203
+ If you pass an empty string argument like `--tagged ''`, an empty list is returned.
204
+
195
205
  You can print the number of found tagged specs by adding `--count` argument
196
206
 
197
207
  ```
198
- $ npx find-cypress-specs --tagged <single tag>
208
+ $ npx find-cypress-specs --tagged <single tag> --count
199
209
  3
200
210
  ```
201
211
 
package/bin/find.js CHANGED
@@ -85,6 +85,10 @@ if (args['--test-counts']) {
85
85
 
86
86
  const specs = getSpecs(undefined, specType)
87
87
 
88
+ // if the user passes "--tagged ''" we want to find the specs
89
+ // but then filter them all out
90
+ const isTaggedPresent = args['--tagged'] || args['--tagged'] === ''
91
+
88
92
  if (args['--branch']) {
89
93
  debug('determining specs changed against branch %s', args['--branch'])
90
94
  let changedFiles = findChangedFiles(args['--branch'], args['--parent'])
@@ -191,8 +195,9 @@ if (args['--test-counts']) {
191
195
  } else {
192
196
  console.log(changedSpecs.join(','))
193
197
  }
194
- } else if (args['--names'] || args['--tags'] || args['--tagged']) {
198
+ } else if (args['--names'] || args['--tags'] || isTaggedPresent) {
195
199
  // counts the number of tests for each tag across all specs
200
+ debug('count number of tests')
196
201
  const { jsonResults, tagTestCounts } = getTests(specs, {
197
202
  tags: args['--tags'],
198
203
  tagged: args['--tagged'],
@@ -248,6 +253,14 @@ if (args['--test-counts']) {
248
253
  debug('printing the spec names list only')
249
254
  const specNames = specs.join(',')
250
255
  console.log(specNames)
256
+
257
+ if (args['--set-gha-outputs']) {
258
+ debug('setting GitHub Actions outputs taggedSpecsN and taggedSpecs')
259
+ debug('taggedSpecsN %d', specs.length)
260
+ debug('plus taggedSpecs')
261
+ core.setOutput('taggedSpecsN', specs.length)
262
+ core.setOutput('taggedSpecs', specNames)
263
+ }
251
264
  }
252
265
  }
253
266
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.36.4",
3
+ "version": "1.37.1",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -25,6 +25,7 @@
25
25
  "demo-names-and-tags-json": "node ./bin/find --names --tags --json",
26
26
  "demo-names-json": "node ./bin/find --names --json",
27
27
  "demo-names-tagged": "node ./bin/find --names --tagged @user",
28
+ "demo-tagged-empty-string": "node ./bin/find --tagged ''",
28
29
  "demo-subfolder": "DEBUG=find-cypress-specs CYPRESS_CONFIG_FILE=mocks/my-app/e2e/cypress.config.js node ./bin/find --names",
29
30
  "print-changed-specs": "node ./bin/find --branch main",
30
31
  "count-changed-specs": "node ./bin/find --branch main --count",
@@ -53,12 +54,12 @@
53
54
  "homepage": "https://github.com/bahmutov/find-cypress-specs#readme",
54
55
  "devDependencies": {
55
56
  "ava": "^4.0.0",
56
- "cypress": "13.3.1",
57
+ "cypress": "13.5.1",
57
58
  "dependency-version-badge": "^1.11.0",
58
59
  "execa-wrap": "^1.4.0",
59
60
  "prettier": "^2.5.1",
60
61
  "really-need": "^1.9.2",
61
- "semantic-release": "22.0.5",
62
+ "semantic-release": "22.0.7",
62
63
  "sinon": "^13.0.1",
63
64
  "typescript": "^4.6.3"
64
65
  },
package/src/index.js CHANGED
@@ -449,7 +449,7 @@ function getTests(specs, options = {}) {
449
449
  debug('added counts')
450
450
  debug(jsonResults)
451
451
 
452
- if (tagged) {
452
+ if (tagged || tagged === '') {
453
453
  // filter all collected tests to those that have the given tag(s)
454
454
  const splitTags = tagged
455
455
  .split(',')