find-cypress-specs 1.6.0 → 1.7.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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/bin/find.js +36 -31
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -33,16 +33,16 @@ Where the tags are listed inside `[ ... ]` (see [cypress-grep](https://github.co
33
33
 
34
34
  ## Test tags
35
35
 
36
- You can count tags attached to the individual tests using `--names --tags` arguments
36
+ You can count tags attached to the individual tests using `--tags` arguments
37
37
 
38
38
  ```
39
- $ npx find-cypress-specs --names --tags
40
- # prints the specs and tests and at the end prints the tags table
39
+ $ npx find-cypress-specs --tags
40
+ # prints the tags table sorted by tag
41
41
 
42
42
  Tag Tests
43
43
  ----- ----------
44
- @user 2
45
44
  @sign 1
45
+ @user 2
46
46
  ```
47
47
 
48
48
  Each tag count includes the tests that use the tag directly, and the _effective_ tags applied from the parent suites.
package/bin/find.js CHANGED
@@ -19,7 +19,7 @@ const args = arg({
19
19
  })
20
20
 
21
21
  const specs = getSpecs()
22
- if (args['--names']) {
22
+ if (args['--names'] || args['--tags']) {
23
23
  if (!specs.length) {
24
24
  console.log('no specs found')
25
25
  } else {
@@ -40,18 +40,20 @@ if (args['--names']) {
40
40
  const testCount = pluralize('test', result.testNames.length, true)
41
41
  pendingTestsN += result.pendingTestCount
42
42
 
43
- if (result.pendingTestCount) {
44
- console.log(
45
- '%s (%s, %d pending)',
46
- filename,
47
- testCount,
48
- result.pendingTestCount,
49
- )
50
- } else {
51
- console.log('%s (%s)', filename, testCount)
43
+ if (args['--names']) {
44
+ if (result.pendingTestCount) {
45
+ console.log(
46
+ '%s (%s, %d pending)',
47
+ filename,
48
+ testCount,
49
+ result.pendingTestCount,
50
+ )
51
+ } else {
52
+ console.log('%s (%s)', filename, testCount)
53
+ }
54
+ console.log(formatTestList(result.structure))
55
+ console.log('')
52
56
  }
53
- console.log(formatTestList(result.structure))
54
- console.log('')
55
57
 
56
58
  if (args['--tags']) {
57
59
  const specTagCounts = countTags(result.structure)
@@ -65,29 +67,32 @@ if (args['--names']) {
65
67
  }
66
68
  })
67
69
 
68
- if (pendingTestsN) {
69
- console.log(
70
- 'found %s (%s, %d pending)',
71
- pluralize('spec', specs.length, true),
72
- pluralize('test', testsN, true),
73
- pendingTestsN,
74
- )
75
- } else {
76
- console.log(
77
- 'found %s (%s)',
78
- pluralize('spec', specs.length, true),
79
- pluralize('test', testsN, true),
80
- )
70
+ if (args['--names']) {
71
+ if (pendingTestsN) {
72
+ console.log(
73
+ 'found %s (%s, %d pending)',
74
+ pluralize('spec', specs.length, true),
75
+ pluralize('test', testsN, true),
76
+ pendingTestsN,
77
+ )
78
+ } else {
79
+ console.log(
80
+ 'found %s (%s)',
81
+ pluralize('spec', specs.length, true),
82
+ pluralize('test', testsN, true),
83
+ )
84
+ }
85
+ console.log('')
81
86
  }
82
- console.log('')
83
87
 
84
88
  if (args['--tags']) {
85
- const table = consoleTable.getTable(
86
- ['Tag', 'Tests'],
87
- Object.entries(tagTestCounts),
88
- )
89
+ const tagEntries = Object.entries(tagTestCounts)
90
+ const sortedTagEntries = tagEntries.sort((a, b) => {
91
+ // every entry is [tag, count], so compare the tags
92
+ return a[0].localeCompare(b[0])
93
+ })
94
+ const table = consoleTable.getTable(['Tag', 'Tests'], sortedTagEntries)
89
95
  console.log(table)
90
- console.log('')
91
96
  }
92
97
  }
93
98
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -15,7 +15,8 @@
15
15
  "cy:run": "DEBUG=cypress:cli,cypress:server:specs cypress run",
16
16
  "demo": "DEBUG=find-cypress-specs node ./bin/find",
17
17
  "demo-names": "node ./bin/find --names",
18
- "demo-tags": "node ./bin/find --names --tags",
18
+ "demo-tags": "node ./bin/find --tags",
19
+ "demo-names-and-tags": "node ./bin/find --names --tags",
19
20
  "semantic-release": "semantic-release"
20
21
  },
21
22
  "repository": {
@@ -41,7 +42,7 @@
41
42
  "arg": "^5.0.1",
42
43
  "console.table": "^0.10.0",
43
44
  "debug": "^4.3.3",
44
- "find-test-names": "^1.14.0",
45
+ "find-test-names": "^1.14.1",
45
46
  "globby": "^11.0.4",
46
47
  "minimatch": "^3.0.4",
47
48
  "pluralize": "^8.0.0"