-
Notifications
You must be signed in to change notification settings - Fork 1
/
compatibility.js
37 lines (32 loc) · 889 Bytes
/
compatibility.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var os = require('os')
, batcher = require('batcher')
, grid = require('./compatibility.json')
, versions = process.versions.node.split('.')
, supported
, jobs
, command
;
// istanbul doesn't play nice on windows
if (os.platform() == 'win32')
{
command = 'npm install ${name}@${version} && tape test/test-${name}*.js | tap-spec';
}
else
{
command = 'npm install ${name}@${version} && istanbul cover --include-pid tape -- test/test-${name}*.js | tap-spec';
}
// find most specific version
versions.forEach(function(v)
{
versions.full = (versions.full ? [versions.full, v].join('.') : v);
if (grid[versions.full])
{
supported = grid[versions.full];
}
});
jobs = Object.keys(supported).map(function(name)
{
return batcher.forEach({ name: name, version: supported[name] }).command(command);
});
// run all the versions one by one
batcher(jobs);