Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logs from test failure summary #3013

Merged
merged 9 commits into from May 16, 2022
Merged

Conversation

il3ven
Copy link
Contributor

@il3ven il3ven commented Apr 20, 2022

As per #2963 (comment), this amateur PR attempts to remove logs from the test failure summary. Closes #2963

Output before this PR
npx ava

  ✔ pass
  ✖ sum Test failed via `t.fail()`
    ℹ v14.18.2
  ─

  sum

    ℹ v14.18.2

  index.test.js:10

    9:   t.log(process.version);
   10:   t.fail()               
   11: });                      

  Test failed via `t.fail()`

  › index.test.js:10:5

  ─

  1 test failed
Output after this PR
npx ava                         

  ✔ pass
  ✖ sum Test failed via `t.fail()`
    ℹ v14.18.2
  ─

  sum
  index.test.js:10

    9:   t.log(process.version);
   10:   t.fail()               
   11: });                      

  Test failed via `t.fail()`

  › index.test.js:10:5

  ─

  1 test failed

Also update .log files in test-tap.
Used `UPDATE_REPORTER_LOG=true npx tap test-tap/reporters/*` to update them.
@novemberborn
Copy link
Member

How can I update the .log files for different node versions?

Using https://volta.sh/:

UPDATE_REPORTER_LOG=true volta run --node 12 npx tap test-tap/reporters/*

I've pushed those updates.

@@ -515,9 +515,6 @@ export default class Reporter {

writeFailure(event) {
this.lineWriter.writeLine(colors.title(this.prefixTitle(event.testFile, event.title)));
if (!this.writeLogs(event, true)) {
this.lineWriter.writeLine();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the diff, I think we need this empty line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the empty line. According to the existing logic, an empty line will be added when there are no logs.

@il3ven il3ven marked this pull request as ready for review May 8, 2022 09:43
@novemberborn novemberborn changed the title remove logs from test failure summary Remove logs from test failure summary May 16, 2022
@novemberborn novemberborn merged commit abfef8e into avajs:main May 16, 2022
@novemberborn
Copy link
Member

Thanks @il3ven!

@il3ven il3ven deleted the duplicate-logs branch May 16, 2022 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate t.log when test fails
2 participants