Skip to content

Commit 5c3101f

Browse files
committed
Build: use different versions of jsdom for Node and iojs testing
Fixes gh-2266
1 parent 62d5579 commit 5c3101f

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

build/tasks/install_jsdom.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = function( grunt ) {
2+
grunt.registerTask( "jsdom", function() {
3+
var current,
4+
pkg = grunt.config( "pkg" ),
5+
version = pkg.jsdomVersions[
6+
7+
// Unfortunately, this is currently the only
8+
// way to tell the difference between Node and iojs
9+
/^v0/.test( process.version ) ? "node" : "iojs"
10+
];
11+
12+
try {
13+
current = require( "jsdom/package.json" ).version;
14+
if ( current === version ) {
15+
return;
16+
}
17+
} catch ( e ) {}
18+
19+
// Use npm on the command-line
20+
// There is no local npm
21+
grunt.util.spawn( {
22+
cmd: "npm",
23+
args: [ "install", "jsdom@" + version ],
24+
opts: { stdio: "inherit" }
25+
}, this.async() );
26+
});
27+
};

build/tasks/node_smoke_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = function( grunt ) {
55
var fs = require( "fs" ),
66
spawnTest = require( "./lib/spawn_test.js" ),
77
testsDir = "./test/node_smoke_tests/",
8-
nodeSmokeTests = [];
8+
nodeSmokeTests = [ "jsdom" ];
99

1010
// Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes.
1111
// All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"grunt-jsonlint": "1.0.4",
4343
"grunt-npmcopy": "0.1.0",
4444
"gzip-js": "0.3.2",
45-
"jsdom": "3.1.2",
4645
"load-grunt-tasks": "1.0.0",
4746
"native-promise-only": "0.7.8-a",
4847
"promises-aplus-tests": "2.1.0",
@@ -54,6 +53,10 @@
5453
"testswarm": "1.1.0",
5554
"win-spawn": "2.0.0"
5655
},
56+
"jsdomVersions": {
57+
"node": "3.1.2",
58+
"iojs": "5.3.0"
59+
},
5760
"scripts": {
5861
"build": "npm install && grunt",
5962
"start": "grunt watch",

0 commit comments

Comments
 (0)