Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] fix broken core tests; change core.json to be an object instead…
… of an array; fix results
- Loading branch information
Showing
3 changed files
with
74 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; | ||
|
||
function versionIncluded(version) { | ||
if (version === '*') return true; | ||
var versionParts = version.split('.'); | ||
function versionIncluded(specifier) { | ||
if (specifier === true) { return true; } | ||
var parts = specifier.split(' '); | ||
var op = parts[0]; | ||
var versionParts = parts[1].split('.'); | ||
|
||
for (var i = 0; i < 3; ++i) { | ||
if ((current[i] || 0) >= (versionParts[i] || 0)) return true; | ||
var cur = Number(current[i] || 0); | ||
var ver = Number(versionParts[i] || 0); | ||
if (cur === ver) { | ||
continue; // eslint-disable-line no-restricted-syntax, no-continue | ||
} | ||
if (op === '<') { | ||
return cur < ver; | ||
} else if (op === '>=') { | ||
return cur >= ver; | ||
} else { | ||
return false; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
var data = require('./core.json'); | ||
|
||
var core = {}; | ||
for (var version in data) { // eslint-disable-line no-restricted-syntax | ||
if (Object.prototype.hasOwnProperty.call(data, version) && versionIncluded(version)) { | ||
for (var i = 0; i < data[version].length; ++i) { | ||
core[data[version][i]] = true; | ||
} | ||
for (var mod in data) { // eslint-disable-line no-restricted-syntax | ||
if (Object.prototype.hasOwnProperty.call(data, mod)) { | ||
core[mod] = versionIncluded(data[mod]); | ||
} | ||
} | ||
module.exports = core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,42 @@ | ||
{ | ||
"*": [ | ||
"assert", | ||
"buffer_ieee754", | ||
"buffer", | ||
"child_process", | ||
"cluster", | ||
"console", | ||
"constants", | ||
"crypto", | ||
"_debugger", | ||
"dgram", | ||
"dns", | ||
"domain", | ||
"events", | ||
"freelist", | ||
"fs", | ||
"http", | ||
"https", | ||
"_linklist", | ||
"module", | ||
"net", | ||
"os", | ||
"path", | ||
"punycode", | ||
"querystring", | ||
"readline", | ||
"repl", | ||
"stream", | ||
"string_decoder", | ||
"sys", | ||
"timers", | ||
"tls", | ||
"tty", | ||
"url", | ||
"util", | ||
"vm", | ||
"zlib" | ||
], | ||
"0.11": [ | ||
"_http_server" | ||
], | ||
"1.0": [ | ||
"process", | ||
"v8" | ||
], | ||
"8.5": [ | ||
"perf_hooks" | ||
] | ||
"assert": true, | ||
"buffer_ieee754": "< 0.9.7", | ||
"buffer": true, | ||
"child_process": true, | ||
"cluster": true, | ||
"console": true, | ||
"constants": true, | ||
"crypto": true, | ||
"_debugger": "< 8", | ||
"dgram": true, | ||
"dns": true, | ||
"domain": true, | ||
"events": true, | ||
"freelist": "< 6.0.0", | ||
"fs": true, | ||
"http": true, | ||
"https": true, | ||
"_http_server": ">= 0.11", | ||
"_linklist": "< 8.0.0", | ||
"module": true, | ||
"net": true, | ||
"os": true, | ||
"path": true, | ||
"perf_hooks": ">= 8.5", | ||
"process": ">= 1", | ||
"punycode": true, | ||
"querystring": true, | ||
"readline": true, | ||
"repl": true, | ||
"stream": true, | ||
"string_decoder": true, | ||
"sys": true, | ||
"timers": true, | ||
"tls": true, | ||
"tty": true, | ||
"url": true, | ||
"util": true, | ||
"v8": ">= 1", | ||
"vm": true, | ||
"zlib": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters