-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Support non-browser environments
Fixes gh-2133 Fixes gh-2501 Closes gh-2504 Refs gh-1950 Refs gh-1949 Refs gh-2397 Refs gh-1537 Refs gh-2504 Refs 842958e
- Loading branch information
Showing
45 changed files
with
363 additions
and
68 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 |
---|---|---|
|
@@ -10,3 +10,5 @@ | |
|
||
/dist | ||
/node_modules | ||
|
||
/test/node_smoke_tests/lib/ensure_iterability.js |
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,5 +1,6 @@ | ||
{ | ||
"preset": "jquery", | ||
|
||
"excludeFiles": [ "external", "src/intro.js", "src/outro.js" ] | ||
"excludeFiles": [ "external", "src/intro.js", "src/outro.js", | ||
"test/node_smoke_tests/lib/ensure_iterability.js" ] | ||
} |
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
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
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 |
---|---|---|
@@ -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() ); | ||
}); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* jshint node: true */ | ||
|
||
"use strict"; | ||
|
||
// Run Node with provided parameters: the first one being the Grunt | ||
// done function and latter ones being files to be tested. | ||
// See the comment in ../node_smoke_tests.js for more information. | ||
module.exports = function spawnTest( done ) { | ||
var testPaths = [].slice.call( arguments, 1 ), | ||
spawn = require( "win-spawn" ); | ||
|
||
spawn( "node", testPaths, { stdio: "inherit" } ) | ||
.on( "close", function( code ) { | ||
done( code === 0 ); | ||
} ); | ||
} ; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = function( grunt ) { | ||
|
||
"use strict"; | ||
|
||
var fs = require( "fs" ), | ||
spawnTest = require( "./lib/spawn_test.js" ), | ||
testsDir = "./test/node_smoke_tests/", | ||
nodeSmokeTests = [ "jsdom", "babel:nodeSmokeTests" ]; | ||
|
||
// 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 | ||
// on success or another one on failure. Spawning in sub-processes is | ||
// important so that the tests & the main process don't interfere with | ||
// each other, e.g. so that they don't share the require cache. | ||
|
||
fs.readdirSync( testsDir ) | ||
.filter( function( testFilePath ) { | ||
return fs.statSync( testsDir + testFilePath ).isFile() && | ||
/\.js$/.test( testFilePath ); | ||
} ) | ||
.forEach( function( testFilePath ) { | ||
var taskName = "node_" + testFilePath.replace( /\.js$/, "" ); | ||
|
||
grunt.registerTask( taskName, function() { | ||
spawnTest( this.async(), "test/node_smoke_tests/" + testFilePath ); | ||
} ); | ||
|
||
nodeSmokeTests.push( taskName ); | ||
} ); | ||
|
||
grunt.registerTask( "node_smoke_tests", nodeSmokeTests ); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = function( grunt ) { | ||
|
||
"use strict"; | ||
|
||
var spawnTest = require( "./lib/spawn_test.js" ); | ||
|
||
grunt.registerTask( "promises_aplus_tests", function() { | ||
spawnTest( this.async(), | ||
"./node_modules/.bin/promises-aplus-tests", | ||
"test/promises_aplus_adapter.js" | ||
); | ||
} ); | ||
}; |
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(function() { | ||
return window.location; | ||
}); |
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
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
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
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
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
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
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
Oops, something went wrong.