Package: node-tap / 12.0.1+ds-1

0003-Render-nyc-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
86
From bb5833c05b5b3e01b028e4c4b524f3925267a9cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Sun, 10 Sep 2017 22:56:51 +0200
Subject: Render nyc optional

Forwarded: no
---
 bin/run.js   | 16 +++++++++++-----
 package.json |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/bin/run.js b/bin/run.js
index 4cef079..a9ec81d 100755
--- a/bin/run.js
+++ b/bin/run.js
@@ -6,7 +6,13 @@ const fs = require('fs')
 const spawn = require('child_process').spawn
 const fg = require('foreground-child')
 const colorSupport = require('supports-color')
-const nycBin = require.resolve('nyc/bin/nyc.js')
+var nycBin;
+function getNycBin() {
+ if (!nycBin) {
+   nycBin = require.resolve('nyc/bin/nyc.js');
+ }
+return nycBin;
+}
 const glob = require('glob')
 const isexe = require('isexe')
 const osHomedir = require('os-homedir')
@@ -426,7 +432,7 @@ const parseArgs = (args, options) => {
 /* istanbul ignore next */
 const respawnWithCoverage = options => {
   // Re-spawn with coverage
-  const args = [nycBin].concat(
+  const args = [getnycBin()].concat(
     '--silent',
     '--cache=true',
     options.nycArgs,
@@ -504,7 +510,7 @@ const runCoverageReportOnly = (options, code, signal) => {
       options.coverageReport = 'text'
   }
 
-  const args = [nycBin, 'report', '--reporter', options.coverageReport]
+  const args = [getnycBin(), 'report', '--reporter', options.coverageReport]
 
   let child
   // automatically hook into coveralls
@@ -543,7 +549,7 @@ const coverageCheckArgs = options => {
 
 /* istanbul ignore next */
 const runCoverageCheck = (options, code, signal) => {
-  const args = [nycBin, 'check-coverage'].concat(coverageCheckArgs(options))
+  const args = [getnycBin(), 'check-coverage'].concat(coverageCheckArgs(options))
 
   const child = fg(node, args)
   child.removeAllListeners('close')
@@ -555,7 +561,7 @@ const usage = _ => fs.readFileSync(__dirname + '/usage.txt', 'utf8')
     .split('@@REPORTERS@@')
     .join(getReporters())
 
-const nycHelp = _ => fg(node, [nycBin, '--help'])
+const nycHelp = _ => fg(node, [getnycBin(), '--help'])
 
 const nycVersion = _ => console.log(require('nyc/package.json').version)
 
diff --git a/package.json b/package.json
index 5a7776c..9bab3fb 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,6 @@
     "js-yaml": "^3.11.0",
     "minipass": "^2.3.0",
     "mkdirp": "^0.5.1",
-    "nyc": "^11.8.0",
     "os-homedir": "^1.0.2",
     "own-or": "^1.0.0",
     "own-or-env": "^1.0.1",
@@ -42,6 +41,7 @@
     "yapool": "^1.0.0"
   },
   "optionalDependencies" : {
+    "nyc": "^11.8.0",
     "opener": "^1.4.1"
   },
   "keywords": [