Skip to content
Browse files

Build: Upgraded to Grunt 0.4.0. Fixes #377.

  • Loading branch information...
1 parent 00dea8e commit cd128bb22ac915cede198d4e065f39d39ee61f4b @JamesMGreene committed Mar 7, 2013
Showing with 51 additions and 46 deletions.
  1. 0 {qunit → }/.jshintrc
  2. +38 −41 grunt.js → Gruntfile.js
  3. +4 −3 addons/phantomjs/runner.js
  4. +8 −2 package.json
  5. +1 −0 test/test.js
View
0 qunit/.jshintrc → .jshintrc
File renamed without changes.
View
79 grunt.js → Gruntfile.js
@@ -1,60 +1,56 @@
-/*global config:true, task:true*/
+/*jshint node:true */
module.exports = function( grunt ) {
grunt.loadNpmTasks( "grunt-git-authors" );
+grunt.loadNpmTasks( "grunt-contrib-jshint" );
+grunt.loadNpmTasks( "grunt-contrib-qunit" );
grunt.initConfig({
- pkg: '<json:package.json>',
+ pkg: "<json:package.json>",
qunit: {
qunit: [
- 'test/index.html',
- 'test/async.html'
+ "test/index.html",
+ "test/async.html"
// TODO figure out why this fails on our Jenkins server (Linux)
- // 'test/logs.html'
+ //"test/logs.html"
],
addons: [
- 'addons/canvas/canvas.html',
- 'addons/close-enough/close-enough.html',
- 'addons/composite/composite-demo-test.html'
+ "addons/canvas/canvas.html",
+ "addons/close-enough/close-enough.html",
+ "addons/composite/composite-demo-test.html"
// TODO same as above
- // 'addons/step/step.html'
+ // "addons/step/step.html"
]
},
- lint: {
- qunit: 'qunit/qunit.js',
- addons: 'addons/**.js',
- tests: 'test/**.js',
- grunt: 'grunt.js'
- },
- // TODO remove this once grunt 0.4 is out, see jquery-ui for other details
- jshint: (function() {
- function parserc( path ) {
- var rc = grunt.file.readJSON( (path || "") + ".jshintrc" ),
- settings = {
- options: rc,
- globals: {}
- };
-
- (rc.predef || []).forEach(function( prop ) {
- settings.globals[ prop ] = true;
- });
- delete rc.predef;
-
- return settings;
+ jshint: {
+ options: {
+ jshintrc: ".jshintrc"
+ },
+ gruntfile: [ "Gruntfile.js" ],
+ qunit: [ "qunit/**/*.js" ],
+ addons: {
+ options: {
+ jshintrc: "addons/.jshintrc"
+ },
+ files: {
+ src: [ "addons/**/*.js" ]
+ }
+ },
+ tests: {
+ options: {
+ jshintrc: "test/.jshintrc"
+ },
+ files: {
+ src: [ "test/**/*.js" ]
+ }
}
-
- return {
- qunit: parserc( "qunit/" ),
- addons: parserc( "addons/" ),
- tests: parserc( "test/" )
- };
- })()
+ }
});
grunt.registerTask( "build-git", function( sha ) {
function processor( content ) {
var tagline = " - A JavaScript Unit Testing Framework";
- return content.replace( tagline, "-" + sha + " " + grunt.template.today('isoDate') + tagline );
+ return content.replace( tagline, "-" + sha + " " + grunt.template.today("isoDate") + tagline );
}
grunt.file.copy( "qunit/qunit.css", "dist/qunit-git.css", {
process: processor
@@ -84,18 +80,19 @@ grunt.registerTask( "testswarm", function( commit, configFile ) {
} )
.addjob(
{
- name: 'QUnit commit #<a href="https://github.com/jquery/qunit/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
+ name: "QUnit commit #<a href='https://github.com/jquery/qunit/commit/" + commit + "'>" + commit.substr( 0, 10 ) + "</a>",
runs: runs,
browserSets: config.browserSets
}, function( err, passed ) {
if ( err ) {
grunt.log.error( err );
}
- done( passed === true );
+ done( passed );
}
);
});
-grunt.registerTask('default', 'lint qunit');
+grunt.registerTask("default", ["test"]);
+grunt.registerTask("test", ["jshint", "qunit"]);
};
View
7 addons/phantomjs/runner.js
@@ -17,16 +17,17 @@
(function() {
'use strict';
- var args = require('system').args;
+ var url, page,
+ args = require('system').args;
// arg[0]: scriptName, args[1...]: arguments
if (args.length !== 2) {
console.error('Usage:\n phantomjs runner.js [url-of-your-qunit-testsuite]');
phantom.exit(1);
}
- var url = args[1],
- page = require('webpage').create();
+ url = args[1];
+ page = require('webpage').create();
// Route `console.log()` calls from within the Page context to the main Phantom context (i.e. current `this`)
page.onConsoleMessage = function(msg) {
View
10 package.json
@@ -29,9 +29,15 @@
"jquery"
],
"main": "qunit/qunit.js",
+ "scripts": {
+ "test": "grunt test"
+ },
"devDependencies": {
- "grunt": "0.3.x",
- "grunt-git-authors": "1.0.0",
+ "grunt-cli": "0.1.6",
+ "grunt": "0.4.0",
+ "grunt-contrib-jshint": "0.2.0",
+ "grunt-contrib-qunit": "0.2.0",
+ "grunt-git-authors": "1.1.0",
"testswarm": "1.0.0-alpha"
}
}
View
1 test/test.js
@@ -470,6 +470,7 @@ test("propEqual", 5, function( assert ) {
});
test("raises", 9, function() {
+ /*jshint es5:true */
function CustomError( message ) {
this.message = message;
}

0 comments on commit cd128bb

Please sign in to comment.
Something went wrong with that request. Please try again.