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