File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,21 @@ ok 3 sumItems should total numbers accurately
7474`
7575 expect ( parser ( example ) . fails ) . toEqual ( [ { message : "sumItems shouldn't return NaN" } ] )
7676 } )
77+ test ( 'should capture error details' , ( ) => {
78+ const example = `
79+ not ok 1 package.json should have a valid "author" key
80+ # AssertionError [ERR_ASSERTION]: no "author" key provided
81+ # at Context.<anonymous> (test/packagejson.test.js:11:12)
82+ # at processImmediate (internal/timers.js:439:21)
83+ # tests 1
84+ # pass 0
85+ # fail 1
86+ # skip 0
87+ `
88+ const result = parser ( example )
89+ expect ( result . fails [ 0 ] . message ) . toBe ( 'package.json should have a valid "author" key' )
90+ expect ( result . fails [ 0 ] . details ) . toBe ( `AssertionError [ERR_ASSERTION]: no "author" key provided
91+ at Context.<anonymous> (test/packagejson.test.js:11:12)
92+ at processImmediate (internal/timers.js:439:21)` )
93+ } )
7794} )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ const parser = (text: string): ParserOutput => {
5454 // check for error details
5555 const isDetails = detect ( 'details' , line )
5656 if ( ! ! isDetails ) {
57- const lineDetails : string = isDetails [ 2 ]
57+ const lineDetails : string = isDetails [ 1 ] . trim ( )
5858 if ( ! currentDetails ) {
5959 currentDetails = lineDetails
6060 } else {
@@ -63,6 +63,7 @@ const parser = (text: string): ParserOutput => {
6363 }
6464 }
6565 }
66+ addCurrentDetails ( )
6667 return result
6768}
6869
You can’t perform that action at this time.
0 commit comments