Skip to content

Commit 1345647

Browse files
committed
fix for test that has for-of loop
1 parent f86064a commit 1345647

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

build/build.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ function processFile (inputLoc, out, replacements) {
5353
'transform-es2015-arrow-functions',
5454
'transform-es2015-block-scoping',
5555
'transform-es2015-template-literals',
56-
'transform-es2015-shorthand-properties'
56+
'transform-es2015-shorthand-properties',
57+
'transform-es2015-for-of'
5758
]
5859
})
5960
data = transformed.code

build/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"babel-core": "^6.5.2",
88
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
99
"babel-plugin-transform-es2015-block-scoping": "^6.5.0",
10+
"babel-plugin-transform-es2015-for-of": "^6.8.0",
1011
"babel-plugin-transform-es2015-shorthand-properties": "^6.8.0",
1112
"babel-plugin-transform-es2015-template-literals": "^6.8.0",
1213
"bl": "~0.6.0",

build/test-replacements.js

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ module.exports['common.js'] = [
104104
+ ' knownGlobals.push(DTRACE_NET_SOCKET_WRITE);\n'
105105
+ ' if (global.__coverage__)\n'
106106
+ ' knownGlobals.push(__coverage__);\n'
107+
+ '\'core,__core-js_shared__,Promise,Map,Set,WeakMap,WeakSet,Reflect,System,asap,Observable,regeneratorRuntime,_babelPolyfill\'.split(\',\').filter(function (item) { return typeof global[item] !== undefined}).forEach(function (item) {knownGlobals.push(global[item])})'
107108
+ ' /*</replacement>*/\n\n$1'
108109
]
109110

@@ -143,6 +144,7 @@ module.exports['common.js'] = [
143144
, [
144145
/^/,
145146
`/*<replacement>*/
147+
require('babel-polyfill');
146148
var util = require('util');
147149
for (var i in util) exports[i] = util[i];
148150
/*</replacement>*/`

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"assert": "~1.4.0",
17+
"babel-polyfill": "^6.9.1",
1718
"nyc": "^6.4.0",
1819
"tap": "~0.7.1",
1920
"tape": "~4.5.1",

test/common.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*<replacement>*/
2+
require('babel-polyfill');
23
var util = require('util');
34
for (var i in util) {
45
exports[i] = util[i];
@@ -349,7 +350,11 @@ if (typeof constructor == 'function') knownGlobals.push(constructor);
349350
if (typeof DTRACE_NET_SOCKET_READ == 'function') knownGlobals.push(DTRACE_NET_SOCKET_READ);
350351
if (typeof DTRACE_NET_SOCKET_WRITE == 'function') knownGlobals.push(DTRACE_NET_SOCKET_WRITE);
351352
if (global.__coverage__) knownGlobals.push(__coverage__);
352-
/*</replacement>*/
353+
'core,__core-js_shared__,Promise,Map,Set,WeakMap,WeakSet,Reflect,System,asap,Observable,regeneratorRuntime,_babelPolyfill'.split(',').filter(function (item) {
354+
return typeof global[item] !== undefined;
355+
}).forEach(function (item) {
356+
knownGlobals.push(global[item]);
357+
}); /*</replacement>*/
353358

354359
function leakedGlobals() {
355360
var leaked = [];

test/parallel/test-stream-pipe-await-drain-manual-resume.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,29 @@ readable.once('pause', common.mustCall(function () {
3838
// fall back to 0 and all chunks that are pending on the readable side
3939
// should be flushed.
4040
isCurrentlyBufferingWrites = false;
41-
for (var queued of queue) {
42-
queued.cb();
41+
var _iteratorNormalCompletion = true;
42+
var _didIteratorError = false;
43+
var _iteratorError = undefined;
44+
45+
try {
46+
for (var _iterator = queue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
47+
var queued = _step.value;
48+
49+
queued.cb();
50+
}
51+
} catch (err) {
52+
_didIteratorError = true;
53+
_iteratorError = err;
54+
} finally {
55+
try {
56+
if (!_iteratorNormalCompletion && _iterator.return) {
57+
_iterator.return();
58+
}
59+
} finally {
60+
if (_didIteratorError) {
61+
throw _iteratorError;
62+
}
63+
}
4364
}
4465
}));
4566
}));

0 commit comments

Comments
 (0)