grunt-contrib-qunit
Advanced tools
Comparing version 0.2.1 to 0.2.2
# Usage examples | ||
## Wildcards | ||
In this example, `grunt qunit:all` (or `grunt qunit` because `qunit` is a [multi task][]) will test all `.html` files in the test directory _and all subdirectories_. First, the wildcard is expanded to match each individual file. Then, each matched filename is passed to [PhantomJS][] (one at a time). | ||
In this example, `grunt qunit:all` will test all `.html` files in the test directory _and all subdirectories_. First, the wildcard is expanded to match each individual file. Then, each matched filename is passed to [PhantomJS][] (one at a time). | ||
@@ -55,5 +55,5 @@ ```js | ||
'http://localhost:8000/test/bar.html', | ||
], | ||
}, | ||
}, | ||
] | ||
} | ||
} | ||
}, | ||
@@ -64,6 +64,6 @@ connect: { | ||
port: 8000, | ||
base: '.', | ||
}, | ||
}, | ||
}, | ||
base: '.' | ||
} | ||
} | ||
} | ||
}); | ||
@@ -70,0 +70,0 @@ |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 "Cowboy" Ben Alman, contributors | ||
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors | ||
* Licensed under the MIT license. | ||
@@ -8,0 +8,0 @@ */ |
{ | ||
"name": "grunt-contrib-qunit", | ||
"description": "Run QUnit unit tests in a headless PhantomJS instance.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-qunit", | ||
@@ -34,6 +34,6 @@ "author": { | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.2.0", | ||
"grunt-contrib-connect": "~0.1.1", | ||
"grunt-contrib-internal": "~0.4.2", | ||
"grunt": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.6.0", | ||
"grunt-contrib-connect": "~0.3.0", | ||
"grunt-contrib-internal": "~0.4.5", | ||
"grunt": "~0.4.1", | ||
"difflet": "~0.2.3" | ||
@@ -40,0 +40,0 @@ }, |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 "Cowboy" Ben Alman, contributors | ||
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors | ||
* Licensed under the MIT license. | ||
@@ -11,49 +11,50 @@ */ | ||
/*global QUnit:true, alert:true*/ | ||
(function () { | ||
'use strict'; | ||
'use strict'; | ||
// Don't re-order tests. | ||
QUnit.config.reorder = false; | ||
// Run tests serially, not in parallel. | ||
QUnit.config.autorun = false; | ||
// Don't re-order tests. | ||
QUnit.config.reorder = false; | ||
// Run tests serially, not in parallel. | ||
QUnit.config.autorun = false; | ||
// Send messages to the parent PhantomJS process via alert! Good times!! | ||
function sendMessage() { | ||
var args = [].slice.call(arguments); | ||
alert(JSON.stringify(args)); | ||
} | ||
// Send messages to the parent PhantomJS process via alert! Good times!! | ||
function sendMessage() { | ||
var args = [].slice.call(arguments); | ||
alert(JSON.stringify(args)); | ||
} | ||
// These methods connect QUnit to PhantomJS. | ||
QUnit.log(function(obj) { | ||
// What is this I don’t even | ||
if (obj.message === '[object Object], undefined:undefined') { return; } | ||
// Parse some stuff before sending it. | ||
var actual = QUnit.jsDump.parse(obj.actual); | ||
var expected = QUnit.jsDump.parse(obj.expected); | ||
// Send it. | ||
sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source); | ||
}); | ||
// These methods connect QUnit to PhantomJS. | ||
QUnit.log(function(obj) { | ||
// What is this I don’t even | ||
if (obj.message === '[object Object], undefined:undefined') { return; } | ||
// Parse some stuff before sending it. | ||
var actual = QUnit.jsDump.parse(obj.actual); | ||
var expected = QUnit.jsDump.parse(obj.expected); | ||
// Send it. | ||
sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source); | ||
}); | ||
QUnit.testStart(function(obj) { | ||
sendMessage('qunit.testStart', obj.name); | ||
}); | ||
QUnit.testStart(function(obj) { | ||
sendMessage('qunit.testStart', obj.name); | ||
}); | ||
QUnit.testDone(function(obj) { | ||
sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total); | ||
}); | ||
QUnit.testDone(function(obj) { | ||
sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total); | ||
}); | ||
QUnit.moduleStart(function(obj) { | ||
sendMessage('qunit.moduleStart', obj.name); | ||
}); | ||
QUnit.moduleStart(function(obj) { | ||
sendMessage('qunit.moduleStart', obj.name); | ||
}); | ||
QUnit.moduleDone(function(obj) { | ||
sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total); | ||
}); | ||
QUnit.moduleDone(function(obj) { | ||
sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total); | ||
}); | ||
QUnit.begin(function() { | ||
sendMessage('qunit.begin'); | ||
}); | ||
QUnit.begin(function() { | ||
sendMessage('qunit.begin'); | ||
}); | ||
QUnit.done(function(obj) { | ||
sendMessage('qunit.done', obj.failed, obj.passed, obj.total, obj.runtime); | ||
}); | ||
QUnit.done(function(obj) { | ||
sendMessage('qunit.done', obj.failed, obj.passed, obj.total, obj.runtime); | ||
}); | ||
}()); |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-qunit [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-qunit.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-qunit) | ||
# grunt-contrib-qunit [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-qunit.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-qunit) | ||
@@ -65,3 +65,3 @@ > Run QUnit unit tests in a headless PhantomJS instance. | ||
#### Wildcards | ||
In this example, `grunt qunit:all` (or `grunt qunit` because `qunit` is a [multi task][]) will test all `.html` files in the test directory _and all subdirectories_. First, the wildcard is expanded to match each individual file. Then, each matched filename is passed to [PhantomJS][] (one at a time). | ||
In this example, `grunt qunit:all` will test all `.html` files in the test directory _and all subdirectories_. First, the wildcard is expanded to match each individual file. Then, each matched filename is passed to [PhantomJS][] (one at a time). | ||
@@ -117,5 +117,5 @@ ```js | ||
'http://localhost:8000/test/bar.html', | ||
], | ||
}, | ||
}, | ||
] | ||
} | ||
} | ||
}, | ||
@@ -126,6 +126,6 @@ connect: { | ||
port: 8000, | ||
base: '.', | ||
}, | ||
}, | ||
}, | ||
base: '.' | ||
} | ||
} | ||
} | ||
}); | ||
@@ -186,2 +186,3 @@ | ||
* 2013-06-06 v0.2.2 Warn if no assertions ran in a single test. Spaces instead of newlines for clickable urls. Wrap bridge.js in a IIFE. | ||
* 2013-04-05 v0.2.1 Update to use PhantomJS 1.9.0. Fixes PhantomJS not found errors. | ||
@@ -198,2 +199,2 @@ * 2013-02-28 v0.2.0 Update to use PhantomJS 1.8.1. | ||
*This file was generated on Fri Apr 05 2013 19:55:03.* | ||
*This file was generated on Thu Jun 06 2013 22:11:10.* |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 "Cowboy" Ben Alman, contributors | ||
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors | ||
* Licensed under the MIT license. | ||
@@ -102,2 +102,4 @@ */ | ||
logFailedAssertions(); | ||
} else if (total === 0) { | ||
grunt.warn('0/0 assertions ran (' + duration + 'ms)'); | ||
} else { | ||
@@ -155,3 +157,3 @@ grunt.log.ok(); | ||
var basename = path.basename(url); | ||
grunt.verbose.subhead('Testing ' + url).or.write('Testing ' + url); | ||
grunt.verbose.subhead('Testing ' + url + ' ').or.write('Testing ' + url + ' '); | ||
@@ -158,0 +160,0 @@ // Reset current module. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
80223
1969
196