[Pkg-javascript-commits] [node-tap] 178/186: Code coverage is optional

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 16:40:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap.

commit 655eac1cc3c00012fe181b2c57987ce30d14c5e4
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date:   Sun Sep 10 23:11:03 2017 +0200

    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 862fdc8..13a96ee 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 c470236..6c80859 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": "^2.13.3",
     "foreground-child": "^1.3.3",
     "fs-exists-cached": "^1.0.0",
     "function-loop": "^1.0.1",
@@ -40,6 +39,7 @@
   },
   "optionalDependencies" : {
     "nyc": "^11.3.0",
+    "coveralls": "^2.13.3",
     "opener": "^1.4.1"
   },
   "keywords": [

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap.git



More information about the Pkg-javascript-commits mailing list