grunt-contrib-qunit
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "grunt-contrib-qunit", | ||
"description": "Run QUnit unit tests in a headless PhantomJS instance", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": { | ||
@@ -16,3 +16,3 @@ "name": "Grunt Team", | ||
"scripts": { | ||
"test": "grunt test --stack" | ||
"test": "grunt test --stack && grunt connect qunit:modules --modules=\"module1\"" | ||
}, | ||
@@ -24,7 +24,6 @@ "dependencies": { | ||
"difflet": "^1.0.1", | ||
"grunt": "^0.4.5", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-connect": "^0.11.2", | ||
"grunt-contrib-internal": "^0.4.13", | ||
"grunt-contrib-jshint": "^0.12.0", | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-connect": "^1.0.0", | ||
"grunt-contrib-internal": "^1.1.0", | ||
"grunt-contrib-jshint": "^1.0.0", | ||
"qunitjs": "^1.20.0" | ||
@@ -31,0 +30,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-qunit v1.1.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-qunit.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-qunit) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/3vd43779joyj6qji/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-qunit/branch/master) | ||
# grunt-contrib-qunit v1.2.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-qunit.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-qunit) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/3vd43779joyj6qji/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-qunit/branch/master) | ||
@@ -103,2 +103,8 @@ > Run QUnit unit tests in a headless PhantomJS instance | ||
### Filtering specs | ||
**Filtering by module name**: | ||
`grunt qunit --modules=foo` will run the module `foo`. You can specify one or multiple, comma-separated modules to run. | ||
### Usage examples | ||
@@ -219,3 +225,3 @@ | ||
* `qunit.fail.timeout`: when a QUnit test times out, usually due to a missing `QUnit.start()` call | ||
* `qunit.error.onError` `(message, stackTrace)` | ||
* `qunit.error.onError` `(message, stackTrace)`: when a JavaScript execution error occurs | ||
@@ -226,3 +232,3 @@ You may listen for these events like so: | ||
grunt.event.on('qunit.spawn', function (url) { | ||
grunt.log.ok("Running test: " + url); | ||
grunt.log.ok('Running test: ' + url); | ||
}); | ||
@@ -234,13 +240,14 @@ ``` | ||
* 2016-03-11 v1.1.0 Adding support for 'summaryOnly'. Fix options.force. Fix query string for noGlobals. update docs. | ||
* 2016-04-14 v1.2.0 Add support for filtering running modules using command line (--modules) Removed 'grunt.warn' output from `error.onError` handler, onus now on end user binding to event. Update docs. | ||
* 2016-03-11 v1.1.0 Adding support for 'summaryOnly'. Fix `options.force`. Fix query string for `noGlobals`. Update docs. | ||
* 2016-02-05 v1.0.1 Change `QUnit.jsDump` to `QUnit.dump`. | ||
* 2016-02-05 v1.0.0 Update grunt-lib-phantomjs to 1.0.0, effectively upgrading to phantomjs 2.x. Remove grunt as a peerDependency | ||
* 2015-04-03 v0.7.0 Log PhantomJS errors as warnings | ||
* 2016-02-05 v1.0.0 Update grunt-lib-phantomjs to 1.0.0, effectively upgrading to phantomjs 2.x. Remove grunt as a peerDependency. | ||
* 2015-04-03 v0.7.0 Log PhantomJS errors as warnings. | ||
* 2015-03-31 v0.6.0 Add noGlobals option, forwarded to QUnit. Report proper exit code to grunt based on failures. Add support for AMD. | ||
* 2014-07-09 v0.5.2 Added support for reporting the duration of testDone. Other minor fixes. | ||
* 2014-07-09 v0.5.2 Added support for reporting the duration of `testDone`. Other minor fixes. | ||
* 2014-05-31 v0.5.1 Updates grunt-lib-phantomjs. | ||
* 2014-05-31 v0.5.0 Add ability to hide PhantomJS console output. Add option for binding phantomjs console to grunt output. Default is true (do bind). Add httpBase option. Only call jsDump.parse() if a test failed. | ||
* 2014-05-31 v0.5.0 Add ability to hide PhantomJS console output. Add option for binding phantomjs console to grunt output. Default is `true` (do bind). Add `httpBase` option. Only call `jsDump.parse()` if a test failed. | ||
* 2014-01-17 v0.4.0 Update grunt-lib-phantomjs to v0.5.0. Explicitly set files to publish to npm. Ref gruntjs/gruntjs.com#65. Update qunit-overview.md, include CentOS dependencies. Closes gh-49. | ||
* 2013-09-29 v0.3.0 Update grunt-lib-phantomjs to v0.4.0. Add qunit.fail.load and qunit.fail.timeout events. Update QUnit to v1.12.0. Add force option. Propagate onError events from phantomjs through the qunit.error.onError event. Remove confusing error message. | ||
* 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-09-29 v0.3.0 Update grunt-lib-phantomjs to v0.4.0. Add `qunit.fail.load` and `qunit.fail.timeout` events. Update QUnit to v1.12.0. Add `force` option. Propagate `onError` events from phantomjs through the `qunit.error.onError` event. Remove confusing error message. | ||
* 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. | ||
@@ -250,3 +257,3 @@ * 2013-02-28 v0.2.0 Update to use PhantomJS 1.8.1. | ||
* 2013-01-18 v0.1.1rc6 Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. | ||
* 2013-01-09 v0.1.1rc5 Updating to work with grunt v0.4.0rc5. Switching to this.filesSrc api. Adding "urls" option for specifying absolute test URLs. | ||
* 2013-01-09 v0.1.1rc5 Updating to work with grunt v0.4.0rc5. Switching to `this.filesSrc` API. Adding `urls` option for specifying absolute test URLs. | ||
* 2012-10-05 v0.1.0 Work in progress, not yet officially released. | ||
@@ -258,2 +265,2 @@ | ||
*This file was generated on Fri Mar 11 2016 16:01:19.* | ||
*This file was generated on Thu Apr 14 2016 16:23:00.* |
@@ -65,3 +65,26 @@ /* | ||
}; | ||
// Copied from QUnit source code | ||
var generateHash = function(module) { | ||
var hex; | ||
var i = 0; | ||
var hash = 0; | ||
var str = module + '\x1C' + undefined; | ||
var len = str.length; | ||
for (; i < len; i++) { | ||
hash = ((hash << 5) - hash) + str.charCodeAt(i); | ||
hash |= 0; | ||
} | ||
// Convert the possibly negative integer hash code into an 8 character | ||
// hex string, which isn't strictly necessary but increases user understanding | ||
// that the id is a SHA-like hash | ||
hex = (0x100000000 + hash).toString(16); | ||
if (hex.length < 8) { | ||
hex = '0000000' + hex; | ||
} | ||
return hex.slice(-8); | ||
}; | ||
// QUnit hooks. | ||
@@ -154,3 +177,2 @@ phantomjs.on('qunit.moduleStart', function(name) { | ||
grunt.event.emit('qunit.error.onError', msg, stackTrace); | ||
grunt.log.warn('PhantomJS error:\n', msg, '\n', stackTrace); | ||
}); | ||
@@ -189,8 +211,8 @@ | ||
var parsed; | ||
if (options.noGlobals) { | ||
// Append a noglobal query string param to all urls | ||
var parsed; | ||
urls = urls.map(function(testUrl) { | ||
parsed = url.parse(testUrl, true); | ||
parsed.query.noglobals = "true"; | ||
parsed.query.noglobals = 'true'; | ||
delete parsed.search; | ||
@@ -201,2 +223,16 @@ return url.format(parsed); | ||
if (grunt.option('modules')) { | ||
var modules = grunt.option('modules').split(','); | ||
var hashes = modules.map(function(module) { | ||
return generateHash(module.trim()); | ||
}); | ||
// Append moduleId to all urls | ||
urls = urls.map(function(testUrl) { | ||
parsed = url.parse(testUrl, true); | ||
parsed.query.moduleId = hashes; | ||
delete parsed.search; | ||
return url.format(parsed); | ||
}); | ||
} | ||
// This task is asynchronous. | ||
@@ -203,0 +239,0 @@ var done = this.async(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25766
6
318
261
1