find-cypress-specs 1.27.2 → 1.28.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +28 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-cypress-specs",
3
- "version": "1.27.2",
3
+ "version": "1.28.0",
4
4
  "description": "Find Cypress spec files using the config settings",
5
5
  "main": "src",
6
6
  "files": [
@@ -58,7 +58,7 @@
58
58
  "arg": "^5.0.1",
59
59
  "console.table": "^0.10.0",
60
60
  "debug": "^4.3.3",
61
- "find-test-names": "1.26.0",
61
+ "find-test-names": "1.27.0",
62
62
  "globby": "^11.0.4",
63
63
  "minimatch": "^3.0.4",
64
64
  "pluralize": "^8.0.0",
package/src/index.js CHANGED
@@ -340,28 +340,34 @@ function getTests(specs, options = {}) {
340
340
  const jsonResults = {}
341
341
 
342
342
  specs.forEach((filename) => {
343
- jsonResults[filename] = {
344
- counts: {
345
- tests: 0,
346
- pending: 0,
347
- },
348
- tests: [],
349
- }
350
- const source = fs.readFileSync(filename, 'utf8')
351
- const result = getTestNames(source, true)
352
- // enable if need to debug the parsed test
353
- // console.dir(result.structure, { depth: null })
354
- collectResults(result.structure, jsonResults[filename].tests)
355
-
356
- if (tags) {
357
- const specTagCounts = countTags(result.structure)
358
- Object.keys(specTagCounts).forEach((tag) => {
359
- if (!(tag in tagTestCounts)) {
360
- tagTestCounts[tag] = specTagCounts[tag]
361
- } else {
362
- tagTestCounts[tag] += specTagCounts[tag]
363
- }
364
- })
343
+ try {
344
+ const source = fs.readFileSync(filename, 'utf8')
345
+ const result = getTestNames(source, true)
346
+
347
+ jsonResults[filename] = {
348
+ counts: {
349
+ tests: 0,
350
+ pending: 0,
351
+ },
352
+ tests: [],
353
+ }
354
+ // enable if need to debug the parsed test
355
+ // console.dir(result.structure, { depth: null })
356
+ collectResults(result.structure, jsonResults[filename].tests)
357
+
358
+ if (tags) {
359
+ const specTagCounts = countTags(result.structure)
360
+ Object.keys(specTagCounts).forEach((tag) => {
361
+ if (!(tag in tagTestCounts)) {
362
+ tagTestCounts[tag] = specTagCounts[tag]
363
+ } else {
364
+ tagTestCounts[tag] += specTagCounts[tag]
365
+ }
366
+ })
367
+ }
368
+ } catch (e) {
369
+ console.error('find-cypress-specs: problem parsing file %s', filename)
370
+ delete jsonResults[filename]
365
371
  }
366
372
  })
367
373