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

feat: simplify stack info in cli error #4749

Merged
merged 6 commits into from Dec 17, 2022

Conversation

TrickyPi
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
related to #4687

Description

@TrickyPi TrickyPi force-pushed the fix/simplify-stack-in-cli-error branch from 12b8688 to a4e5c9a Compare December 13, 2022 03:13
@TrickyPi
Copy link
Member Author

Weirdly, the test/cli/samples/watch/bundle-error test fail on some platforms.

@lukastaegert
Copy link
Member

Yes, this is completely weird. It seems to be caused by your change, but I do not understand how. I also saw this problem locally for a moment, but then it worked again mysteriously.

@TrickyPi
Copy link
Member Author

TrickyPi commented Dec 16, 2022

I found the test/cli/samples/watch/bundle-error test is similar to test/cli/samples/watch/watch-config-initial-error, the only or greatest difference is test/cli/samples/watch/bundle-error folder does not contain main.js file at first.

@lukastaegert lukastaegert force-pushed the fix/simplify-stack-in-cli-error branch 2 times, most recently from 30b8c9f to 0b8cdf0 Compare December 16, 2022 05:53
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Merging #4749 (3f1fc51) into master (e315ffc) will increase coverage by 0.00%.
The diff coverage is 88.88%.

@@           Coverage Diff           @@
##           master    #4749   +/-   ##
=======================================
  Coverage   99.04%   99.04%           
=======================================
  Files         217      217           
  Lines        7709     7711    +2     
  Branches     2134     2134           
=======================================
+ Hits         7635     7637    +2     
  Misses         24       24           
  Partials       50       50           
Impacted Files Coverage Δ
cli/logging.ts 95.45% <88.88%> (+0.45%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

lukastaegert and others added 2 commits December 16, 2022 09:08
Apparently, the test fails randomly if the new file is written in response to a
log that is not the last one
@lukastaegert
Copy link
Member

Ok, here is what I found:

  • abortOnStderr was triggered individually for each line in the output because logging.ts writes the error output in several chunks by calling the stderr function several times.
  • because the error message was contained both in the first output line as well as the stack trace, this triggered rewriting the file twice.
  • when the error message was removed from the stack trace, this obviously now only triggered writing the file once. Even though the test already had a 500ms wait between the message and writing the file, this apparently was not enough to pick up the changed file sometimes.
  • when I changed the test to look for a text contained only in the stack trace, this fixed the test reliably. However, I would not want to make assertions on the stack trace content as functions are renamed from time to time.
  • Instead, I changed logging.ts to write all lines together. This also fixes the test and is probably not a bad idea.

Unless you have anything else to add, I would merge this by tomorrow.

@TrickyPi
Copy link
Member Author

TrickyPi commented Dec 16, 2022

Awesome, I have nothing to add.

@lukastaegert lukastaegert merged commit ffab4cd into rollup:master Dec 17, 2022
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.7.5. You can test it via npm install rollup.

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.

None yet

3 participants