find-cypress-specs 1.1.0 → 1.3.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/bin/find.js +26 -8
- package/package.json +4 -3
package/bin/find.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const arg = require('arg')
|
|
4
4
|
const { getSpecs } = require('../src')
|
|
5
5
|
const fs = require('fs')
|
|
6
|
+
const pluralize = require('pluralize')
|
|
6
7
|
const { getTestNames, formatTestList } = require('find-test-names')
|
|
7
8
|
|
|
8
9
|
const args = arg({
|
|
@@ -14,15 +15,32 @@ const args = arg({
|
|
|
14
15
|
|
|
15
16
|
const specs = getSpecs()
|
|
16
17
|
if (args['--names']) {
|
|
17
|
-
specs.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// enable if need to debug the parsed test
|
|
21
|
-
// console.dir(result.structure, { depth: null })
|
|
22
|
-
console.log(filename)
|
|
23
|
-
console.log(formatTestList(result.structure))
|
|
18
|
+
if (!specs.length) {
|
|
19
|
+
console.log('no specs found')
|
|
20
|
+
} else {
|
|
24
21
|
console.log('')
|
|
25
|
-
|
|
22
|
+
let testsN = 0
|
|
23
|
+
specs.forEach((filename) => {
|
|
24
|
+
const source = fs.readFileSync(filename, 'utf8')
|
|
25
|
+
const result = getTestNames(source, true)
|
|
26
|
+
// enable if need to debug the parsed test
|
|
27
|
+
// console.dir(result.structure, { depth: null })
|
|
28
|
+
|
|
29
|
+
testsN += result.testNames.length
|
|
30
|
+
const testCount = pluralize('test', result.testNames.length, true)
|
|
31
|
+
|
|
32
|
+
console.log('%s (%s)', filename, testCount)
|
|
33
|
+
console.log(formatTestList(result.structure))
|
|
34
|
+
console.log('')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
console.log(
|
|
38
|
+
'found %s and %s',
|
|
39
|
+
pluralize('spec', specs.length, true),
|
|
40
|
+
pluralize('test', testsN, true),
|
|
41
|
+
)
|
|
42
|
+
console.log('')
|
|
43
|
+
}
|
|
26
44
|
} else {
|
|
27
45
|
console.log(specs.join(','))
|
|
28
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "find-cypress-specs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Find Cypress spec files using the config settings",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"files": [
|
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"arg": "^5.0.1",
|
|
41
41
|
"debug": "^4.3.3",
|
|
42
|
-
"find-test-names": "^1.9.
|
|
42
|
+
"find-test-names": "^1.9.4",
|
|
43
43
|
"globby": "^11.0.4",
|
|
44
|
-
"minimatch": "^3.0.4"
|
|
44
|
+
"minimatch": "^3.0.4",
|
|
45
|
+
"pluralize": "^8.0.0"
|
|
45
46
|
}
|
|
46
47
|
}
|