find-cypress-specs 1.8.0 → 1.9.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.
- package/README.md +2 -0
- package/bin/find.js +2 -8
- package/package.json +2 -1
- package/src/index.js +28 -0
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ found 2 specs (4 tests, 1 pending)
|
|
|
31
31
|
|
|
32
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.
|
|
33
33
|
|
|
34
|
+
You can print the results in JSON format using `--json` or `-j` option.
|
|
35
|
+
|
|
34
36
|
## Test tags
|
|
35
37
|
|
|
36
38
|
You can count tags attached to the individual tests using `--tags` arguments
|
package/bin/find.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const arg = require('arg')
|
|
4
|
-
const { getSpecs } = require('../src')
|
|
4
|
+
const { getSpecs, collectResults } = require('../src')
|
|
5
5
|
const fs = require('fs')
|
|
6
6
|
const pluralize = require('pluralize')
|
|
7
7
|
const { getTestNames, formatTestList, countTags } = require('find-test-names')
|
|
@@ -47,13 +47,7 @@ if (args['--names'] || args['--tags']) {
|
|
|
47
47
|
|
|
48
48
|
if (args['--names']) {
|
|
49
49
|
if (args['--json']) {
|
|
50
|
-
result.structure
|
|
51
|
-
if (t.type === 'test') {
|
|
52
|
-
jsonResults[filename].push(t.name)
|
|
53
|
-
} else if (t.type === 'suite') {
|
|
54
|
-
jsonResults[filename].push(t.name)
|
|
55
|
-
}
|
|
56
|
-
})
|
|
50
|
+
collectResults(result.structure, jsonResults[filename])
|
|
57
51
|
} else {
|
|
58
52
|
if (result.pendingTestCount) {
|
|
59
53
|
console.log(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Find Cypress spec files using the config settings",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"files": [
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"demo-names": "node ./bin/find --names",
|
|
18
18
|
"demo-tags": "node ./bin/find --tags",
|
|
19
19
|
"demo-names-and-tags": "node ./bin/find --names --tags",
|
|
20
|
+
"demo-names-json": "node ./bin/find --names --json",
|
|
20
21
|
"semantic-release": "semantic-release"
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -72,9 +72,37 @@ function getSpecs() {
|
|
|
72
72
|
return specs
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
function collectResults(structure, results) {
|
|
76
|
+
structure.forEach((t) => {
|
|
77
|
+
const info = {
|
|
78
|
+
name: t.name,
|
|
79
|
+
type: t.type,
|
|
80
|
+
tags: t.tags,
|
|
81
|
+
}
|
|
82
|
+
if (t.pending) {
|
|
83
|
+
info.pending = t.pending
|
|
84
|
+
}
|
|
85
|
+
results.push(info)
|
|
86
|
+
if (t.type === 'suite') {
|
|
87
|
+
if (t.suites && t.suites.length) {
|
|
88
|
+
// skip empty nested suites
|
|
89
|
+
info.suites = []
|
|
90
|
+
collectResults(t.suites, info.suites)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (t.tests && t.tests.length) {
|
|
94
|
+
// skip empty nested tests
|
|
95
|
+
info.tests = []
|
|
96
|
+
collectResults(t.tests, info.tests)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
75
102
|
module.exports = {
|
|
76
103
|
getSpecs,
|
|
77
104
|
// individual utilities
|
|
78
105
|
getConfig,
|
|
79
106
|
findCypressSpecs,
|
|
107
|
+
collectResults,
|
|
80
108
|
}
|