Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit 1d47858

Browse files
authoredMay 10, 2019
adjustments (#680)
* adjust promisify to node 10+ * run test-50-reject-* on linux only * set host to node12 * enable armv7 in test-42-fetch-all * add 12->6 to npm version map in test-79-npm * remove unneeded test-50-bakery-4
1 parent b0da4ee commit 1d47858

File tree

8 files changed

+44
-78
lines changed

8 files changed

+44
-78
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language:
22
- node_js
3-
node_js: 10
3+
node_js: 12
44
services:
55
- mongodb
66
sudo: true

‎prelude/bootstrap.js

+34-24
Original file line numberDiff line numberDiff line change
@@ -1458,25 +1458,37 @@ function payloadFileSync (pointer) {
14581458
var promisify = util.promisify;
14591459
if (promisify) {
14601460
var custom = promisify.custom;
1461-
var binding = process.binding('util');
1462-
var createPromise = binding.createPromise;
1463-
var promiseResolve = binding.promiseResolve;
1464-
var promiseReject = binding.promiseReject;
14651461
var customPromisifyArgs = require('internal/util').customPromisifyArgs;
1462+
var createPromise;
1463+
1464+
if (NODE_VERSION_MAJOR <= 8) {
1465+
var binding = process.binding('util');
1466+
var promiseResolve = binding.promiseResolve;
1467+
var promiseReject = binding.promiseReject;
1468+
createPromise = function (fn) {
1469+
var p = binding.createPromise;
1470+
var resolve = promiseResolve.bind(p);
1471+
var reject = promiseReject.bind(p);
1472+
fn(resolve, reject);
1473+
return p;
1474+
};
1475+
} else {
1476+
createPromise = function (fn) {
1477+
return new Promise(fn);
1478+
};
1479+
}
14661480

14671481
// /////////////////////////////////////////////////////////////
14681482
// FS //////////////////////////////////////////////////////////
14691483
// /////////////////////////////////////////////////////////////
14701484

14711485
Object.defineProperty(require('fs').exists, custom, {
14721486
value: function (path) {
1473-
var promise = createPromise();
1474-
1475-
require('fs').exists(path, function (exists) {
1476-
promiseResolve(promise, exists);
1487+
return createPromise(function (resolve) {
1488+
require('fs').exists(path, function (exists) {
1489+
resolve(exists);
1490+
});
14771491
});
1478-
1479-
return promise;
14801492
}
14811493
});
14821494

@@ -1492,22 +1504,20 @@ function payloadFileSync (pointer) {
14921504
// CHILD_PROCESS ///////////////////////////////////////////////
14931505
// /////////////////////////////////////////////////////////////
14941506

1495-
var customPromiseExecFunction = function (orig) {
1507+
var customPromiseExecFunction = function (o) {
14961508
return function () {
14971509
var args = Array.from(arguments);
1498-
var promise = createPromise();
1499-
1500-
orig.apply(undefined, args.concat(function (error, stdout, stderr) {
1501-
if (error !== null) {
1502-
error.stdout = stdout;
1503-
error.stderr = stderr;
1504-
promiseReject(promise, error);
1505-
} else {
1506-
promiseResolve(promise, { stdout: stdout, stderr: stderr });
1507-
}
1508-
}));
1509-
1510-
return promise;
1510+
return createPromise(function (resolve, reject) {
1511+
o.apply(undefined, args.concat(function (error, stdout, stderr) {
1512+
if (error !== null) {
1513+
error.stdout = stdout;
1514+
error.stderr = stderr;
1515+
reject(error);
1516+
} else {
1517+
resolve({ stdout: stdout, stderr: stderr });
1518+
}
1519+
}));
1520+
});
15111521
};
15121522
};
15131523

‎test/test-42-fetch-all/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ function nodeRangeToNodeVersion (nodeRange) {
1616

1717
for (const platform of knownPlatforms) {
1818
const nodeRanges = [ 'node8', 'node10', 'node12' ];
19+
if (platform === 'linux' || platform === 'alpine') nodeRanges.unshift('node6');
1920
if (platform === 'linux') nodeRanges.unshift('node4');
20-
if (platform !== 'macos' && platform !== 'win') nodeRanges.unshift('node6');
2121
for (const nodeRange of nodeRanges) {
2222
const nodeVersion = nodeRangeToNodeVersion(nodeRange);
2323
const archs = [ 'x64' ];
2424
if (platform === 'win') archs.unshift('x86');
25-
// TODO restore // if (platform === 'linux') archs.push('armv7');
25+
if (platform === 'linux') archs.push('armv7');
2626
// linux-armv7 is needed in multi-arch tests,
2727
// so keeping it here as obligatory. but let's
2828
// leave compiling for freebsd to end users

‎test/test-50-bakery-4/main.js

-34
This file was deleted.

‎test/test-50-bakery-4/test-x-index.js

-16
This file was deleted.

‎test/test-50-reject-4/main.js

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const utils = require('../utils.js');
99
assert(!module.parent);
1010
assert(__dirname === process.cwd());
1111

12+
// only linux has node4
13+
if (process.platform !== 'linux') return;
14+
1215
const target = 'node4';
1316
const inputs = { index: './test-x-index.js', warmup: './test-x-warmup.js' };
1417
const output = './run-time/test-output.exe';

‎test/test-50-reject-6/main.js

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const utils = require('../utils.js');
99
assert(!module.parent);
1010
assert(__dirname === process.cwd());
1111

12+
// only linux and alpine have node6
13+
if (process.platform !== 'linux' && process.platform !== 'alpine') return;
14+
1215
const target = 'node6';
1316
const inputs = { index: './test-x-index.js', warmup: './test-x-warmup.js' };
1417
const output = './run-time/test-output.exe';

‎test/test-79-npm/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const hostVersion = process.version.match(/^v(\d+)/)[1];
1919
const host = 'node' + hostVersion;
2020
const target = process.argv[2] || host;
2121
const windows = process.platform === 'win32';
22-
const npm = { 0: 2, 4: 2, 6: 3, 7: 4, 8: 5, 9: 5, 10: 5 }[hostVersion];
22+
const npm = { 0: 2, 4: 2, 6: 3, 7: 4, 8: 5, 9: 5, 10: 5, 12: 6 }[hostVersion];
2323
assert(npm !== undefined);
2424

2525
function applyMetaToRight (right, meta) {

0 commit comments

Comments
 (0)
This repository has been archived.