grunt-wendy
Advanced tools
Comparing version 0.0.6 to 1.0.0
@@ -8,4 +8,6 @@ 'use strict'; | ||
test: { | ||
series: {}, | ||
parallel: {}, | ||
series: {} | ||
parallelFiltered: {}, | ||
nofail: {}, | ||
}, | ||
@@ -36,6 +38,25 @@ | ||
}, | ||
dubious: { | ||
parallelFiltered: { | ||
options: { | ||
async: 'each', | ||
cli: ['--foo=bar'], | ||
formatterOptions: { | ||
whitespace: true, | ||
filter: /(Test file:)|(tests executed)/ | ||
} | ||
}, | ||
files: { src: ['test/a*.js'] } | ||
}, | ||
dubious: { // don't fail | ||
options: { | ||
fail: [], | ||
warn: ['dubious', 'failed'] | ||
}, | ||
files: { src: ['test/c*.js'] } | ||
}, | ||
fail: { | ||
fail: { // don't fail | ||
options: { | ||
fail: [], | ||
warn: ['dubious', 'failed'] | ||
}, | ||
files: { src: ['test/d*.js'] } | ||
@@ -59,2 +80,8 @@ } | ||
} | ||
else if (this.target === 'parallelFiltered') { | ||
grunt.task.run(['wendy:parallelFiltered']); | ||
} | ||
else if (this.target === 'nofail') { | ||
grunt.task.run(['wendy:dubious', 'wendy:fail']); | ||
} | ||
}); | ||
@@ -61,0 +88,0 @@ |
{ | ||
"name": "grunt-wendy", | ||
"description": "CasperJS test runner", | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/davidosomething/grunt-wendy", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -10,3 +10,3 @@ # grunt-wendy | ||
[![Development Dependency Status][davidDevBadge]][davidDevLink] | ||
<br>[![npm Badge][nodeiBadge]]([nodeiLink]) | ||
<br>[![npm Badge][nodeiBadge]][nodeiLink] | ||
@@ -61,6 +61,9 @@ This was originally a fork of [ronaldlokers/grunt-casperjs] but with more | ||
async: 'eachSeries', | ||
clean: true, | ||
cli: [], | ||
runner: 'test', | ||
formatter: formatter, // function in tasks/lib/formatter.js | ||
formatterOptions: { | ||
whitespace: true, | ||
filter: null | ||
}, | ||
fail: ['failed'], | ||
@@ -92,19 +95,2 @@ warn: ['dubious', 'skipped'] | ||
#### Clean | ||
This task tries to clean up the casper output a bit and outputs aggregated | ||
test results when multiple suites (multiple files) are run in a single task. | ||
You can set the option to false to disable it. **The default formatter uses this | ||
option.** | ||
```javascript | ||
wendy: { | ||
options: { | ||
clean: false | ||
}, | ||
tests: ['tests/e2e/**/*.js'] | ||
} | ||
``` | ||
#### CLI Options | ||
@@ -160,2 +146,27 @@ | ||
#### Formatter Options | ||
This task tries to clean up the casper output whitespace and outputs aggregated | ||
test results when multiple suites (multiple files) are run in a single task. | ||
**If you change the `formatter` this option may not apply.** | ||
* `whitespace`: boolean -- true to clean up casper whitespace | ||
* `filter`: regex -- anything that matches this filter will not be output | ||
```javascript | ||
wendy: { | ||
options: { | ||
formatterOptions: { | ||
// don't try to clean up whitespace | ||
whitespace: false, | ||
// don't output lines saying 'Test file:' name and the suite summary | ||
filter: /(Test file:)|(tests executed)/ | ||
} | ||
}, | ||
tests: ['tests/e2e/**/*.js'] | ||
} | ||
``` | ||
#### Grunt exit status | ||
@@ -188,2 +199,5 @@ | ||
## CHANGELOG | ||
* 1.0.0 | ||
* Change `clean` to `formatterOptions.whitespace` | ||
* Add `filter` to formatterOptions | ||
* 0.0.6 | ||
@@ -190,0 +204,0 @@ * Add `fail` and `warn` options |
@@ -1,11 +0,32 @@ | ||
module.exports = function (grunt, options, data) { | ||
if (options.clean) { | ||
if (data.indexOf('Test file:') > -1) { | ||
process.stdout.write(grunt.util.linefeed); | ||
/** | ||
* formatCasperOutput | ||
* | ||
* @param {object} grunt | ||
* @param {object} options from grunt task | ||
* @param {string} data casper output line | ||
*/ | ||
module.exports = function formatCasperOutput(grunt, options, data) { | ||
if (options.formatterOptions) { | ||
// should this line be filtered out? | ||
if (options.formatterOptions.filter) { | ||
if (options.formatterOptions.filter.test(data)) { | ||
return; | ||
} | ||
} | ||
process.stdout.write(' ' + data); | ||
// format whitespace? | ||
if (options.formatterOptions.whitespace) { | ||
if (data.indexOf('Test file:') > -1) { | ||
process.stdout.write(grunt.util.linefeed); | ||
} | ||
process.stdout.write(' ' + data); | ||
return; | ||
} | ||
} | ||
else { | ||
process.stdout.write(data); | ||
} | ||
// default -- straight output | ||
process.stdout.write(data); | ||
return; | ||
}; |
@@ -20,8 +20,12 @@ 'use strict'; | ||
var done = this.async(); | ||
var options = this.options({ | ||
async: 'eachSeries', | ||
clean: true, | ||
cli: [], | ||
runner: 'test', | ||
formatter: formatter, | ||
formatterOptions: { | ||
whitespace: true, | ||
filter: null | ||
}, | ||
fail: ['failed'], | ||
@@ -28,0 +32,0 @@ warn: ['dubious', 'skipped'], |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
119942
341
0
243