Skip to content

Commit

Permalink
Tests: Node tests now reuse QUnit tests, replacing nodeunit
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
leobalter committed Jun 1, 2014
1 parent 8702e65 commit 3474660
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 426 deletions.
15 changes: 10 additions & 5 deletions Gruntfile.js
Expand Up @@ -47,6 +47,14 @@ module.exports = function( grunt ) {
},
all: [ 'test/*.html' ]
},
qunitnode: {
all: [
'test/unit/environment.js',
'test/unit/spy.js',
'test/unit/fake.js',
'test/unit/restore.js'
]
},
coveralls: {
options: {
force: true
Expand All @@ -56,9 +64,6 @@ module.exports = function( grunt ) {
src: 'build/report/lcov/lcov.info'
}
},
nodeunit: {
all: [ 'test/test-node.js' ]
},
jshint: {
options: {
jshintrc: '.jshintrc'
Expand Down Expand Up @@ -102,11 +107,11 @@ module.exports = function( grunt ) {
[
'grunt-contrib-concat',
'grunt-contrib-jshint',
'grunt-contrib-nodeunit',
'grunt-contrib-uglify',
'grunt-contrib-watch',
'grunt-coveralls',
'grunt-jscs-checker',
'grunt-qunitnode',
'grunt-qunit-istanbul'
].forEach( function( task ) {
grunt.loadNpmTasks( task );
Expand All @@ -125,6 +130,6 @@ module.exports = function( grunt ) {
});

// Default task.
grunt.registerTask( 'default', 'jshint jscs qunit concat uglify nodeunit'.split( ' ' ) );
grunt.registerTask( 'default', 'jshint jscs qunit qunitnode concat uglify'.split( ' ' ) );

};
2 changes: 1 addition & 1 deletion dist/dexter.js
@@ -1,4 +1,4 @@
/*! DexterJS - v0.5.1 - 2014-05-20
/*! DexterJS - v0.5.1 - 2014-06-01
* https://github.com/leobalter/DexterJS
* Copyright (c) 2014 Leonardo Balter; Licensed MIT, GPL */
(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/dexter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -39,19 +39,19 @@
"bdd"
],
"scripts": {
"ci": "grunt -v jshint jscs qunit nodeunit coveralls",
"test": "grunt -v jshint jscs qunit nodeunit"
"ci": "grunt -v jshint jscs qunit qunitnode coveralls",
"test": "grunt -v jshint jscs qunit qunitnode"
},
"devDependencies": {
"grunt": "0.4.2",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-jshint": "0.8.0",
"grunt-contrib-nodeunit": "0.3.2",
"grunt-contrib-uglify": "0.3.2",
"grunt-contrib-watch": "0.5.3",
"grunt-coveralls": "0.3.0",
"grunt-jscs-checker": "0.4.0",
"grunt-qunit-istanbul": "0.3.0",
"grunt-qunitnode": "0.1.2",
"mdoc": "0.3.4",
"qunitjs": "1.14.0",
"requirejs": "2.1.11"
Expand Down
234 changes: 0 additions & 234 deletions test/test-node.js

This file was deleted.

34 changes: 21 additions & 13 deletions test/unit/environment.js
@@ -1,19 +1,27 @@
/* API Ref: http://api.qunitjs.com */
/* globals Dexter:true, QUnit: true, expect: true */
/* globals QUnit: true */

QUnit.module( 'Environment' );
(function() {

QUnit.test( 'Dexter is here!', function( assert ) {
expect( 2 );
var Dexter;

assert.equal( typeof( Dexter ), 'object', 'Dexter is an object' );
assert.ok( Dexter, 'Dexter is not falsy' );
});
// NPM scope
if ( !Dexter && typeof module !== 'undefined' && module.exports ) {
Dexter = require( '../../src/Dexter.js' );
} else {
Dexter = window.Dexter;
}

QUnit.test( 'Dexter functions', function( assert ) {
expect( 3 );
QUnit.module( 'Environment' );

assert.equal( typeof( Dexter.spy ), 'function', 'Dexter.spy is a function' );
assert.equal( typeof( Dexter.fake ), 'function', 'Dexter.fake is a function' );
assert.equal( typeof( Dexter.fakeXHR ), 'function', 'Dexter.fakeXHR is a function' );
});
QUnit.test( 'Dexter is here!', function( assert ) {
assert.equal( typeof( Dexter ), 'object', 'Dexter is an object' );
assert.ok( Dexter, 'Dexter is not falsy' );
});

QUnit.test( 'Dexter functions', function( assert ) {
assert.equal( typeof( Dexter.spy ), 'function', 'Dexter.spy is a function' );
assert.equal( typeof( Dexter.fake ), 'function', 'Dexter.fake is a function' );
});

}());

0 comments on commit 3474660

Please sign in to comment.