aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-05-06 16:23:00 -0700
committerTimmy Willison <timmywillisn@gmail.com>2015-05-07 09:57:59 -0700
commit5c3101fee60046fa7976b3131fada8dfe9fbd53e (patch)
tree580bcf230672de7d2b161fc78c83d749a9dea4f1 /build
parent62d5579578109f1468a37e44f76af06f283a46ab (diff)
downloadjquery-5c3101fee60046fa7976b3131fada8dfe9fbd53e.tar.gz
jquery-5c3101fee60046fa7976b3131fada8dfe9fbd53e.zip
Build: use different versions of jsdom for Node and iojs testing
Fixes gh-2266
Diffstat (limited to 'build')
-rw-r--r--build/tasks/install_jsdom.js27
-rw-r--r--build/tasks/node_smoke_tests.js2
2 files changed, 28 insertions, 1 deletions
diff --git a/build/tasks/install_jsdom.js b/build/tasks/install_jsdom.js
new file mode 100644
index 000000000..21d67eb0e
--- /dev/null
+++ b/build/tasks/install_jsdom.js
@@ -0,0 +1,27 @@
+module.exports = function( grunt ) {
+ grunt.registerTask( "jsdom", function() {
+ var current,
+ pkg = grunt.config( "pkg" ),
+ version = pkg.jsdomVersions[
+
+ // Unfortunately, this is currently the only
+ // way to tell the difference between Node and iojs
+ /^v0/.test( process.version ) ? "node" : "iojs"
+ ];
+
+ try {
+ current = require( "jsdom/package.json" ).version;
+ if ( current === version ) {
+ return;
+ }
+ } catch ( e ) {}
+
+ // Use npm on the command-line
+ // There is no local npm
+ grunt.util.spawn( {
+ cmd: "npm",
+ args: [ "install", "jsdom@" + version ],
+ opts: { stdio: "inherit" }
+ }, this.async() );
+ });
+};
diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js
index 2a741c57a..077745b83 100644
--- a/build/tasks/node_smoke_tests.js
+++ b/build/tasks/node_smoke_tests.js
@@ -5,7 +5,7 @@ module.exports = function( grunt ) {
var fs = require( "fs" ),
spawnTest = require( "./lib/spawn_test.js" ),
testsDir = "./test/node_smoke_tests/",
- nodeSmokeTests = [];
+ nodeSmokeTests = [ "jsdom" ];
// Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes.
// All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code