find-cypress-specs 1.3.0 → 1.4.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 +5 -3
  2. package/bin/find.js +27 -7
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -16,15 +16,17 @@ You can print each spec file with the suite and test names inside of it (found u
16
16
  $ npx find-cypress-specs --names
17
17
  # prints something like
18
18
 
19
- cypress/e2e/spec.js
19
+ cypress/e2e/spec.js (2 tests)
20
20
  └─ parent suite [@main]
21
- ├─ works
21
+ ├─ works well enough
22
22
  └─ inner suite
23
23
  └─ shows something [@user]
24
24
 
25
- cypress/e2e/featureA/user.js
25
+ cypress/e2e/featureA/user.js (2 tests, 1 pending)
26
26
  ├─ works
27
27
  └⊙ needs to be written
28
+
29
+ found 2 specs (4 tests, 1 pending)
28
30
  ```
29
31
 
30
32
  Where the tags are listed inside `[ ... ]` (see [cypress-grep](https://github.com/cypress-io/cypress-grep)) and the [pending tests](https://glebbahmutov.com/blog/cypress-test-statuses/) are marked with `⊙` character.
package/bin/find.js CHANGED
@@ -20,25 +20,45 @@ if (args['--names']) {
20
20
  } else {
21
21
  console.log('')
22
22
  let testsN = 0
23
+ let pendingTestsN = 0
23
24
  specs.forEach((filename) => {
24
25
  const source = fs.readFileSync(filename, 'utf8')
25
26
  const result = getTestNames(source, true)
26
27
  // enable if need to debug the parsed test
27
28
  // console.dir(result.structure, { depth: null })
28
29
 
29
- testsN += result.testNames.length
30
+ testsN += result.testCount
30
31
  const testCount = pluralize('test', result.testNames.length, true)
32
+ pendingTestsN += result.pendingTestCount
31
33
 
32
- console.log('%s (%s)', filename, testCount)
34
+ if (result.pendingTestCount) {
35
+ console.log(
36
+ '%s (%s, %d pending)',
37
+ filename,
38
+ testCount,
39
+ result.pendingTestCount,
40
+ )
41
+ } else {
42
+ console.log('%s (%s)', filename, testCount)
43
+ }
33
44
  console.log(formatTestList(result.structure))
34
45
  console.log('')
35
46
  })
36
47
 
37
- console.log(
38
- 'found %s and %s',
39
- pluralize('spec', specs.length, true),
40
- pluralize('test', testsN, true),
41
- )
48
+ if (pendingTestsN) {
49
+ console.log(
50
+ 'found %s (%s, %d pending)',
51
+ pluralize('spec', specs.length, true),
52
+ pluralize('test', testsN, true),
53
+ pendingTestsN,
54
+ )
55
+ } else {
56
+ console.log(
57
+ 'found %s (%s)',
58
+ pluralize('spec', specs.length, true),
59
+ pluralize('test', testsN, true),
60
+ )
61
+ }
42
62
  console.log('')
43
63
  }
44
64
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "arg": "^5.0.1",
41
41
  "debug": "^4.3.3",
42
- "find-test-names": "^1.9.4",
42
+ "find-test-names": "^1.12.1",
43
43
  "globby": "^11.0.4",
44
44
  "minimatch": "^3.0.4",
45
45
  "pluralize": "^8.0.0"