File tree 2 files changed +19
-1
lines changed
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
74
74
`
75
75
expect ( parser ( example ) . fails ) . toEqual ( [ { message : "sumItems shouldn't return NaN" } ] )
76
76
} )
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
+ } )
77
94
} )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ const parser = (text: string): ParserOutput => {
54
54
// check for error details
55
55
const isDetails = detect ( 'details' , line )
56
56
if ( ! ! isDetails ) {
57
- const lineDetails : string = isDetails [ 2 ]
57
+ const lineDetails : string = isDetails [ 1 ] . trim ( )
58
58
if ( ! currentDetails ) {
59
59
currentDetails = lineDetails
60
60
} else {
@@ -63,6 +63,7 @@ const parser = (text: string): ParserOutput => {
63
63
}
64
64
}
65
65
}
66
+ addCurrentDetails ( )
66
67
return result
67
68
}
68
69
You can’t perform that action at this time.
0 commit comments