jasmine-line-per-spec-reporter 0.3.0 (2016-04-20)
Always report one line per spec, regardless of spec status.
Provided as a reporter class for the jasmine test framework.
Example
The output format is:
status-right-padded - spec-number-left-padded/total-spec-count - full suite/spec description indented expect messages are output on FAILURE
Such that output would look like:
Passed - 1/4 - Suite one Sub-suite AAA Spec oneFAILED - 2/4 - Suite one Sub-suite BBB Spec two Expected 1 to be 0. Pending - 3/4 - Suite one Sub-suite BBB Spec threeDisabled - 4/4 - Suite one Sub-suite CCC Spec four
Given these suites/specs:
;
Installation
The easiest way is to keep jasmine-line-per-spec-reporter
as a devDependency
in your package.json
. Just run
npm install jasmine-line-per-spec-reporter --save-dev
to let npm
automatically add it there.
Configuration
protractor
In your protractor.conf.js
file:
-
At the top, or with the other
require
lines, add:const JasmineLinePerSpecReporter = ; -
In the
config.onPrepare
function, add:if browserparamslinePerSpecReporter === truejasmine; -
You can also hide disabled specs. So, if you're using any fdescribe/fit, or disabling remaining lines on failure, you won't see superfluous Disabled lines. In the
config.onPrepare
function, add:if browserparamslinePerSpecReporter === trueconst conifg =hideDisabled: true;jasmine;This will produce output like the following:
Passed - 1/4 - Suite one Sub-suite AAA Spec oneFAILED - 2/4 - Suite one Sub-suite BBB Spec twoExpected 1 to be 0.Pending - 3/4 - Suite one Sub-suite BBB Spec three1 disabled spec was hidden -
You can also see stack trace lines that only match the path to your spec files, without all the extra stack trace junk you get from the default reporter. E.g., If you project root folder is
my-project-folder
and all your tests are inmy-project-folder/test/spec
, then in theconfig.onPrepare
function, add:if browserparamslinePerSpecReporter === trueconst conifg =failureExpectationMessageSuffixLine: ''failureSuffixLine: nullshowStackTrace: trueshowStackTraceRegExMatch: /^.*[\\\/]\)$/gshowStackTraceRegExReplace: ' at $1'showStackTraceRegExShowMax: 1;jasmine;This will produce output for each failure showing only the first stack trace line that matches your criteria, like the following:
Passed - 1/4 - Suite one Sub-suite AAA Spec oneFAILED - 2/4 - Suite one Sub-suite BBB Spec twoExpected 1 to be 0.Stack trace :at my-project-folder/test/spec/myTest.js:10:8Pending - 3/4 - Suite one Sub-suite BBB Spec threeDisabled - 4/4 - Suite one Sub-suite CCC Spec four
grunt
+ protractor
If you are using grunt
, this configuration will allow you to specify the protractor
flag from the grunt
command line.
You must modify the protractor
configuration in your Gruntfile.js
as:
protractor: options: args: params: // Map the `grunt` command line argument: // --linePerSpecReporter=true // to the `protractor` boolean property: // browser.params.linePerSpecReporter linePerSpecReporter: grunt
grunt
+ regular jasmine
TODO
Usage
protractor
Run your usual protractor
command with the extra flag:
--params.linePerSpecReporter=true
e.g.:
protractor --params.linePerSpecReporter=true
grunt
Run your usual grunt
command with the extra flag:
--linePerSpecReporter=true
e.g.:
grunt test --linePerSpecReporter=true
TODO
-
Needs documentation -- Until fully documented, see
defaultConfig
indist/jasmine-line-per-spec-reporter.js
for all of the properties that can be set usingoptionalConfig
as:jasmine; -
Feature -- Optional time prefixes:
-
Delta -- time between each spec as
SS.mmm
, e.g.:00.000 Passed - 1/4 - Suite one Sub-suite AAA Spec one00.250 FAILED - 2/4 - Suite one Sub-suite BBB Spec twoExpected 1 to be 0.00.133 Pending - 3/4 - Suite one Sub-suite BBB Spec three00.088 Disabled - 4/4 - Suite one Sub-suite CCC Spec four -
Relative -- time since first spec
MM:SS.mmm
, e.g.:00:00.000 Passed - 1/4 - Suite one Sub-suite AAA Spec one00:00.133 FAILED - 2/4 - Suite one Sub-suite BBB Spec twoExpected 1 to be 0.00:00.250 Pending - 3/4 - Suite one Sub-suite BBB Spec three00:00.250 Disabled - 4/4 - Suite one Sub-suite CCC Spec four -
Current -- current time as
YYYY-MM-DD HH:MM:SS.mmm
, e.g.:2016-04-19 16:00:00.000 Passed - 1/4 - Suite one Sub-suite AAA Spec one2016-04-19 16:00:00.133 FAILED - 2/4 - Suite one Sub-suite BBB Spec twoExpected 1 to be 0.2016-04-19 16:00:00.250 Pending - 3/4 - Suite one Sub-suite BBB Spec three2016-04-19 16:00:00.250 Disabled - 4/4 - Suite one Sub-suite CCC Spec four
-
Changelog / Release History
See CHANGELOG.md.