diff --git a/build/test-replacements.js b/build/test-replacements.js index 692df2252f..33246f3a92 100644 --- a/build/test-replacements.js +++ b/build/test-replacements.js @@ -167,6 +167,10 @@ module.exports['common.js'] = [ , '\n/**/\nvar util = require(\'core-util-is\');\n' + 'util.inherits = require(\'inherits\');\n/**/\n' ] +, [ + /process\.binding\('timer_wrap'\)\.Timer;/, + '{now: function (){}}' +] ] // this test has some trouble with the nextTick depth when run diff --git a/package.json b/package.json index f16201e382..bf136db695 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ }, "scripts": { "test": "tap test/parallel/*.js test/ours/*.js", - "browser": "npm run write-zuul && zuul -- test/browser.js", + "browser": "npm run write-zuul && zuul --browser-retries 2 -- test/browser.js", "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml", - "local": "zuul --local -- test/browser.js", + "local": "zuul --local 3000 --no-coverage -- test/browser.js", "cover": "nyc npm test", "report": "nyc report --reporter=lcov" }, diff --git a/test/browser/test-stream-push-order.js b/test/browser/test-stream-push-order.js index acffd41ba1..22fe17d1b0 100644 --- a/test/browser/test-stream-push-order.js +++ b/test/browser/test-stream-push-order.js @@ -27,8 +27,7 @@ module.exports = function (t) { // ACTUALLY [1, 3, 5, 6, 4, 2] setTimeout(function() { - t.deepEqual(s._readableState.buffer, - ['1', '2', '3', '4', '5', '6']); + t.equals(s._readableState.buffer.join(','), '1,2,3,4,5,6'); }); }); } diff --git a/test/browser/test-stream2-readable-from-list.js b/test/browser/test-stream2-readable-from-list.js index 62492668a0..e0f2b1b80d 100644 --- a/test/browser/test-stream2-readable-from-list.js +++ b/test/browser/test-stream2-readable-from-list.js @@ -1,16 +1,22 @@ -'use strict'; -var common = require('../common'); +// Flags: --expose_internals +/**/ +var bufferShim = require('buffer-shims'); +/**/ +require('../common'); var fromList = require('../../lib/_stream_readable')._fromList; +var BufferList = require('../../lib/internal/streams/BufferList'); +function bufferListFromArray(arr) { + var bl = new BufferList(); + for (var i = 0; i < arr.length; ++i) { + bl.push(arr[i]); + }return bl; +} module.exports = function (t) { - t.test('buffers', function(t) { - // have a length - var len = 16; - var list = [ new Buffer('foog'), - new Buffer('bark'), - new Buffer('bazy'), - new Buffer('kuel') ]; + t.test('buffers', function (t) { + var list = [bufferShim.from('foog'), bufferShim.from('bark'), bufferShim.from('bazy'), bufferShim.from('kuel')]; + list = bufferListFromArray(list); // read more than the first element. var ret = fromList(6, { buffer: list, length: 16 }); @@ -29,18 +35,14 @@ module.exports = function (t) { t.equal(ret.toString(), 'zykuel'); // all consumed. - t.same(list, []); + t.same(list, new BufferList()); t.end(); }); - t.test('strings', function(t) { - // have a length - var len = 16; - var list = [ 'foog', - 'bark', - 'bazy', - 'kuel' ]; + t.test('strings', function (t) { + var list = ['foog', 'bark', 'bazy', 'kuel']; + list = bufferListFromArray(list); // read more than the first element. var ret = fromList(6, { buffer: list, length: 16, decoder: true }); @@ -59,7 +61,7 @@ module.exports = function (t) { t.equal(ret, 'zykuel'); // all consumed. - t.same(list, []); + t.same(list, new BufferList()); t.end(); }); diff --git a/test/common.js b/test/common.js index ee4c1433a8..4e933019c8 100644 --- a/test/common.js +++ b/test/common.js @@ -39,7 +39,7 @@ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ -var Timer = process.binding('timer_wrap').Timer; +var Timer = { now: function () {} }; var testRoot = path.resolve(process.env.NODE_TEST_DIR || path.dirname(__filename)); diff --git a/test/parallel/test-stream-push-order.js b/test/parallel/test-stream-push-order.js index 9f4fa15758..39f44ede55 100644 --- a/test/parallel/test-stream-push-order.js +++ b/test/parallel/test-stream-push-order.js @@ -30,4 +30,4 @@ s.read(0); process.on('exit', function () { assert.deepStrictEqual(s._readableState.buffer.join(','), '1,2,3,4,5,6'); console.log('ok'); -}); \ No newline at end of file +});