aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/tasks/node_smoke_tests.js3
-rw-r--r--test/node_smoke_tests/.jshintrc14
-rw-r--r--test/node_smoke_tests/document_missing.js20
-rw-r--r--test/node_smoke_tests/document_passed.js9
-rw-r--r--test/node_smoke_tests/document_present_originally.js9
-rw-r--r--test/node_smoke_tests/lib/ensure_global_not_created.js10
-rw-r--r--test/node_smoke_tests/lib/ensure_jquery.js10
7 files changed, 36 insertions, 39 deletions
diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js
index 077745b83..5c23dae2b 100644
--- a/build/tasks/node_smoke_tests.js
+++ b/build/tasks/node_smoke_tests.js
@@ -15,7 +15,8 @@ module.exports = function( grunt ) {
fs.readdirSync( testsDir )
.filter( function( testFilePath ) {
- return fs.statSync( testsDir + testFilePath ).isFile();
+ return fs.statSync( testsDir + testFilePath ).isFile() &&
+ /\.js$/.test( testFilePath );
} )
.forEach( function( testFilePath ) {
var taskName = "node_" + testFilePath.replace( /\.js$/, "" );
diff --git a/test/node_smoke_tests/.jshintrc b/test/node_smoke_tests/.jshintrc
new file mode 100644
index 000000000..1445c7b18
--- /dev/null
+++ b/test/node_smoke_tests/.jshintrc
@@ -0,0 +1,14 @@
+{
+ "boss": true,
+ "curly": true,
+ "eqeqeq": true,
+ "eqnull": true,
+ "expr": true,
+ "immed": true,
+ "noarg": true,
+ "quotmark": "double",
+ "undef": true,
+ "unused": true,
+
+ "node": true
+}
diff --git a/test/node_smoke_tests/document_missing.js b/test/node_smoke_tests/document_missing.js
index 0a0bda350..4a0ad2e2b 100644
--- a/test/node_smoke_tests/document_missing.js
+++ b/test/node_smoke_tests/document_missing.js
@@ -1,19 +1,11 @@
-/* jshint node: true */
-
"use strict";
-var ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
+var assert = require( "assert" ),
+ ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
jQueryFactory = require( "../../dist/jquery.js" );
-try {
+assert.throws( function () {
jQueryFactory( {} );
- console.error( "The jQuery factory should reject window without a document" );
- process.exit( 1 );
-} catch ( e ) {
- if ( e.message === "jQuery requires a window with a document" ) {
- ensureGlobalNotCreated( module.exports );
- process.exit( 0 );
- }
- console.error( "An unexpected error thrown; message: ", e.message );
- process.exit( 1 );
-}
+}, /jQuery requires a window with a document/ );
+
+ensureGlobalNotCreated( module.exports );
diff --git a/test/node_smoke_tests/document_passed.js b/test/node_smoke_tests/document_passed.js
index 5bbddb718..5999cc744 100644
--- a/test/node_smoke_tests/document_passed.js
+++ b/test/node_smoke_tests/document_passed.js
@@ -1,12 +1,9 @@
-/* jshint node: true */
-
"use strict";
+var assert = require( "assert" );
+
require( "jsdom" ).env( "", function( errors, window ) {
- if ( errors ) {
- console.error( errors );
- process.exit( 1 );
- }
+ assert.ifError( errors );
var ensureJQuery = require( "./lib/ensure_jquery" ),
ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
diff --git a/test/node_smoke_tests/document_present_originally.js b/test/node_smoke_tests/document_present_originally.js
index 76fa88e86..f75148708 100644
--- a/test/node_smoke_tests/document_present_originally.js
+++ b/test/node_smoke_tests/document_present_originally.js
@@ -1,12 +1,9 @@
-/* jshint node: true */
-
"use strict";
+var assert = require( "assert" );
+
require( "jsdom" ).env( "", function( errors, window ) {
- if ( errors ) {
- console.error( errors );
- process.exit( 1 );
- }
+ assert.ifError( errors );
// Pretend the window is a global.
global.window = window;
diff --git a/test/node_smoke_tests/lib/ensure_global_not_created.js b/test/node_smoke_tests/lib/ensure_global_not_created.js
index e2ce98309..7cc83b541 100644
--- a/test/node_smoke_tests/lib/ensure_global_not_created.js
+++ b/test/node_smoke_tests/lib/ensure_global_not_created.js
@@ -1,7 +1,7 @@
-/* jshint node: true */
-
"use strict";
+var assert = require( "assert" );
+
// Ensure the jQuery property on global/window/module.exports/etc. was not
// created in a CommonJS environment.
// `global` is always checked in addition to passed parameters.
@@ -9,9 +9,7 @@ module.exports = function ensureGlobalNotCreated() {
var args = [].slice.call( arguments ).concat( global );
args.forEach( function( object ) {
- if ( object.jQuery ) {
- console.error( "A jQuery global was created in a CommonJS environment." );
- process.exit( 1 );
- }
+ assert.strictEqual( object.jQuery, undefined,
+ "A jQuery global was created in a CommonJS environment." );
} );
};
diff --git a/test/node_smoke_tests/lib/ensure_jquery.js b/test/node_smoke_tests/lib/ensure_jquery.js
index f121f6652..0933a1d33 100644
--- a/test/node_smoke_tests/lib/ensure_jquery.js
+++ b/test/node_smoke_tests/lib/ensure_jquery.js
@@ -1,11 +1,9 @@
-/* jshint node: true */
-
"use strict";
+var assert = require( "assert" );
+
// Check if the object we got is the jQuery object by invoking a basic API.
module.exports = function ensureJQuery( jQuery ) {
- if ( !/^jQuery/.test( jQuery.expando ) ) {
- console.error( "jQuery.expando was not detected, the jQuery bootstrap process has failed" );
- process.exit( 1 );
- }
+ assert( /^jQuery/.test( jQuery.expando ),
+ "jQuery.expando was not detected, the jQuery bootstrap process has failed" );
};