Package: node-tap / 12.0.1+ds-1

0013-Code-coverage-is-optional.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 0d00c86f2926e51a1ff51d43f33b29ace25ffd5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Sun, 10 Sep 2017 23:11:03 +0200
Subject: Code coverage is optional

Forwarded: no
---
 bin/run.js   | 22 +++++++++++++++++++---
 package.json |  2 +-
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bin/run.js b/bin/run.js
index 78ba63b..b33ba69 100755
--- a/bin/run.js
+++ b/bin/run.js
@@ -45,13 +45,17 @@ if (coverageServiceTest)
 // Currently only Coveralls is supported, but the infrastructure
 // is left in place in case some noble soul fixes the codecov
 // module in the future.  See https://github.com/tapjs/node-tap/issues/270
-const coverageServices = [
+var coverageServices = []
+try {
+coverageServices.push(
   {
     env: 'COVERALLS_REPO_TOKEN',
     bin: require.resolve('coveralls/bin/coveralls.js'),
     name: 'Coveralls'
   }
-]
+);
+}
+catch(e) {}
 
 const main = _ => {
   const args = process.argv.slice(2)
@@ -94,7 +98,14 @@ const main = _ => {
   /* istanbul ignore next */
   if ((options.coverageReport || options.checkCoverage) &&
       options.files.length === 0)
+    {
+    try {
     return runCoverageReport(options)
+    }
+    catch(e) {
+        console.warn("Code coverage is disabled because some modules are missing")
+    }
+    }
 
   if (options.files.length === 0) {
     console.error('Reading TAP data from stdin (use "-" argument to suppress)')
@@ -112,8 +123,13 @@ const main = _ => {
   // By definition, the next block cannot be covered, because
   // they are only relevant when coverage is turned off.
   /* istanbul ignore next */
-  if (options.coverage && !global.__coverage__) {
+  if (options.coverage && !global.__coverage__)
+  {
+  try {
     return respawnWithCoverage(options)
+  } catch(e) {
+    console.warn("Code coverage is disabled because some modules are missing")
+  }
   }
 
   setupTapEnv(options)
diff --git a/package.json b/package.json
index c18e34a..d981c32 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,6 @@
     "bluebird": "^3.5.1",
     "clean-yaml-object": "^0.1.0",
     "supports-color" : "^3",
-    "coveralls": "^3.0.1",
     "foreground-child": "^1.3.3",
     "fs-exists-cached": "^1.0.0",
     "function-loop": "^1.0.1",
@@ -40,6 +39,7 @@
   },
   "optionalDependencies" : {
     "nyc": "^11.8.0",
+    "coveralls": "^3.0.1",
     "opener": "^1.4.1"
   },
   "keywords": [