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

Commit1e84908

Browse files
authored
Tests: add actual and expected messages to test reporter
Closegh-5443
1 parent60f11b5 commit1e84908

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

‎test/runner/reporter.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ export function reportTest( test, reportId, { browser, headless } ) {
1010
return;
1111
}
1212

13-
letmessage=`Test${test.status} on${chalk.yellow(
13+
letmessage=`${chalk.bold(`${test.suiteName}:${test.name}`)}`;
14+
message+=`\nTest${test.status} on${chalk.yellow(
1415
getBrowserString(browser,headless)
1516
)} (${chalk.bold(reportId)}).`;
16-
message+=`\n${chalk.bold(`${test.suiteName}:${test.name}`)}`;
1717

18-
// Prefer failed assertions over error messages
19-
if(test.assertions.filter((a)=>!!a&&!a.passed).length){
20-
test.assertions.forEach((assertion,i)=>{
21-
if(!assertion.passed){
22-
message+=`\n${i+1}.${chalk.red(assertion.message)}`;
23-
message+=`\n${chalk.gray(assertion.stack)}`;
24-
}
25-
});
26-
}elseif(test.errors.length){
18+
// test.assertions only contains passed assertions;
19+
// test.errors contains all failed asssertions
20+
if(test.errors.length){
2721
for(consterroroftest.errors){
28-
message+=`\n${chalk.red(error.message)}`;
22+
message+="\n";
23+
message+=`\n${error.message}`;
2924
message+=`\n${chalk.gray(error.stack)}`;
25+
if(error.expected&&error.actual){
26+
message+=`\nexpected:${JSON.stringify(error.expected)}`;
27+
message+=`\nactual:${chalk.red(JSON.stringify(error.actual))}`;
28+
}
3029
}
3130
}
3231

3332
console.log("\n\n"+message);
3433

34+
// Only return failed messages
3535
if(test.status==="failed"){
3636
returnmessage;
3737
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp