summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/JSONStream/test
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/JSONStream/test')
-rw-r--r--deps/npm/node_modules/JSONStream/test/parsejson.js6
-rw-r--r--deps/npm/node_modules/JSONStream/test/run.js13
2 files changed, 18 insertions, 1 deletions
diff --git a/deps/npm/node_modules/JSONStream/test/parsejson.js b/deps/npm/node_modules/JSONStream/test/parsejson.js
index 7f157175f5..df4fbbe73a 100644
--- a/deps/npm/node_modules/JSONStream/test/parsejson.js
+++ b/deps/npm/node_modules/JSONStream/test/parsejson.js
@@ -9,6 +9,9 @@ var r = Math.random()
, p = new Parser()
, assert = require('assert')
, times = 20
+ , bufferFrom = Buffer.from && Buffer.from !== Uint8Array.from
+ , str
+
while (times --) {
assert.equal(JSON.parse(JSON.stringify(r)), r, 'core JSON')
@@ -18,7 +21,8 @@ while (times --) {
assert.equal(v,r)
}
console.error('correct', r)
- p.write (new Buffer(JSON.stringify([r])))
+ str = JSON.stringify([r])
+ p.write (bufferFrom ? Buffer.from(str) : new Buffer(str))
diff --git a/deps/npm/node_modules/JSONStream/test/run.js b/deps/npm/node_modules/JSONStream/test/run.js
new file mode 100644
index 0000000000..7d62e7385b
--- /dev/null
+++ b/deps/npm/node_modules/JSONStream/test/run.js
@@ -0,0 +1,13 @@
+var readdirSync = require('fs').readdirSync
+var spawnSync = require('child_process').spawnSync
+var extname = require('path').extname
+
+var files = readdirSync(__dirname)
+files.forEach(function(file){
+ if (extname(file) !== '.js' || file === 'run.js')
+ return
+ console.log(`*** ${file} ***`)
+ var result = spawnSync(process.argv0, [file], { stdio: 'inherit', cwd: __dirname} )
+ if (result.status !== 0)
+ process.exit(result.status)
+})