[Pkg-javascript-commits] [node-tap-mocha-reporter] 55/137: use readable-stream for v0.8 support

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:26 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-mocha-reporter.

commit 431f89ac5bd681117e6955aae3607dda83564094
Author: isaacs <i at izs.me>
Date:   Wed May 6 11:43:46 2015 -0700

    use readable-stream for v0.8 support
---
 index.js         | 9 +++++++++
 lib/formatter.js | 9 +++++++++
 lib/runner.js    | 9 +++++++++
 package.json     | 5 ++++-
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 6faf0bc..92ce756 100755
--- a/index.js
+++ b/index.js
@@ -6,6 +6,15 @@ var util = require('util')
 var reporters = require('./lib/reporters/index.js')
 Formatter.types = Object.keys(reporters).sort()
 var Writable = require('stream').Writable
+if (!Writable) {
+  try {
+    Writale = require('readable-stream').Writable
+  } catch (er) {
+    throw new Error('Please install "readable-stream" to use this module ' +
+                    'with Node.js v0.8 and before')
+  }
+}
+
 var Runner = require('./lib/runner.js')
 var Parser = require('tap-parser')
 require('exit-code')
diff --git a/lib/formatter.js b/lib/formatter.js
index 91cd89f..c0f1d96 100644
--- a/lib/formatter.js
+++ b/lib/formatter.js
@@ -4,6 +4,15 @@
 // See tap-classic.js for an example of a formatter in use.
 
 var Duplex = require('stream').Duplex
+if (!Duplex) {
+  try {
+    Duplex = require('readable-stream').Duplex
+  } catch (er) {
+    throw new Error('Please install "readable-stream" to use this module ' +
+                    'with Node.js v0.8 and before')
+  }
+}
+
 var util = require('util')
 var Parser = require('tap-parser')
 util.inherits(Formatter, Duplex)
diff --git a/lib/runner.js b/lib/runner.js
index b1df12d..3e0c141 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -45,6 +45,15 @@ var util = require('util')
 var Test = require('./test.js')
 var Suite = require('./suite.js')
 var Writable = require('stream').Writable
+if (!Writable) {
+  try {
+    Writable = require('readable-stream').Writable
+  } catch (er) {
+    throw new Error('Please install "readable-stream" to use this module ' +
+                    'with Node.js v0.8 and before')
+  }
+}
+
 var Parser = require('tap-parser')
 
 // $1 = number, $2 = units
diff --git a/package.json b/package.json
index e180388..183aaee 100644
--- a/package.json
+++ b/package.json
@@ -29,5 +29,8 @@
   "devDependencies": {
     "tap": "^1.0.0-beta"
   },
-  "bin": "index.js"
+  "bin": "index.js",
+  "optionalDependencies": {
+    "readable-stream": "^1.1.13"
+  }
 }

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



More information about the Pkg-javascript-commits mailing list