Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite61c14d

Browse files
committed
capture details in test parser
1 parentfdf68c2 commite61c14d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎src/services/testRunner/parser.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
constexample=`
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+
constresult=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
})

‎src/services/testRunner/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const parser = (text: string): ParserOutput => {
5454
// check for error details
5555
constisDetails=detect('details',line)
5656
if(!!isDetails){
57-
constlineDetails:string=isDetails[2]
57+
constlineDetails: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
returnresult
6768
}
6869

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp