find-cypress-specs 1.44.15 → 1.45.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 +1 -1
- package/package.json +1 -1
- package/src/print.js +37 -38
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Find Cypress spec files using the config settings
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
$ npx find-cypress-specs
|
package/package.json
CHANGED
package/src/print.js
CHANGED
|
@@ -60,32 +60,37 @@ function stringAllInfo(allInfo, tagged) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
function getJustTheTestMarkdown(tests, parentName = '', markdown = []) {
|
|
64
|
+
if (!tests) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const name = parentName + tests.name
|
|
67
69
|
|
|
68
70
|
if (tests.type === 'test') {
|
|
69
|
-
|
|
71
|
+
const tags = tests?.tags?.join(', ') ?? ''
|
|
72
|
+
|
|
73
|
+
markdown.push(`| \`${name}\` | ${tags} |`)
|
|
74
|
+
|
|
70
75
|
return
|
|
71
76
|
} else if (tests.type === 'suite') {
|
|
72
|
-
const prefix =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
77
|
+
const prefix = `${name} / `
|
|
78
|
+
|
|
79
|
+
getJustTheTestMarkdown(tests.tests, prefix, markdown)
|
|
80
|
+
|
|
81
|
+
tests.suites?.forEach((suite) => {
|
|
82
|
+
getJustTheTestMarkdown(suite, prefix, markdown)
|
|
83
|
+
})
|
|
84
|
+
|
|
81
85
|
return
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
// tests can include regular tests plus suites nodes
|
|
85
|
-
tests.forEach((testOrSuite) =>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
tests.forEach((testOrSuite) =>
|
|
90
|
+
getJustTheTestMarkdown(testOrSuite, parentName, markdown),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return markdown
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
/**
|
|
@@ -94,31 +99,25 @@ function getJustTheTestNames(tests, parentName = '', justNames = []) {
|
|
|
94
99
|
* @returns {string}
|
|
95
100
|
*/
|
|
96
101
|
function stringMarkdownTests(allInfo) {
|
|
102
|
+
const testWord = (counts) => pluralize('test', counts.tests, true)
|
|
103
|
+
|
|
97
104
|
const counts = sumTestCounts(allInfo)
|
|
98
105
|
const specNames = Object.keys(allInfo)
|
|
99
106
|
const specWord = pluralize('Spec', specNames.length, true)
|
|
100
|
-
const testWord = pluralize('test', counts.tests, true)
|
|
101
107
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const testNames = getJustTheTestNames(fileInfo.tests)
|
|
114
|
-
testNames.forEach((name) => {
|
|
115
|
-
specTest += '| `' + name + '` |\n'
|
|
116
|
-
})
|
|
117
|
-
return specTest
|
|
118
|
-
})
|
|
119
|
-
.join('')
|
|
108
|
+
const markdown = [
|
|
109
|
+
`| ${specWord} with ${testWord(counts)} | Tags |`,
|
|
110
|
+
'| --- | --- |',
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
specNames.forEach((fileName) => {
|
|
114
|
+
const { counts, tests } = allInfo[fileName]
|
|
115
|
+
|
|
116
|
+
markdown.push(`| **\`${fileName}\`** (${testWord(counts)}) ||`)
|
|
117
|
+
markdown.push(...getJustTheTestMarkdown(tests))
|
|
118
|
+
})
|
|
120
119
|
|
|
121
|
-
return
|
|
120
|
+
return markdown.join('\n')
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
module.exports = {
|