Skip to content

Conversation

andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Sep 26, 2025

This is useful when running test snippets. Update READMEs including to mention how to do that.

Testing
Adds directed tests.

Squash or Rebase? Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@andyleiserson
Copy link
Contributor Author

@crowlKats would be interested in your thoughts here on whether this is an appropriate thing to do in Deno. It would also be possible to do this just in cts_runner and avoid changing the behavior for other applications.

I chose to do it in Deno based on the following note:

After dispatching the event, user agents should surface uncaptured errors to developers, for example as warnings in the browser’s developer console, unless the event’s defaultPrevented is true. In other words, calling preventDefault() on the event should silence the console warning.

But stderr is not exactly analogous to the browser console.

@crowlKats
Copy link
Collaborator

crowlKats commented Sep 27, 2025

yeah this is not something we'd want: we basically never want to print to the terminal from internal logic.

@andyleiserson

This comment was marked as resolved.

This is useful when running test snippets. Update READMEs including to
mention how to do that.
@andyleiserson andyleiserson changed the title [deno] Print uncaptured errors to stderr, unless preventDefault() is called [cts_runner] Print uncaptured errors to stderr Oct 4, 2025
@andyleiserson
Copy link
Contributor Author

I moved the uncaptured error hook from Deno to cts_runner.

I have not seen it in my local runs (the CTS primarily uses error scopes), but it's possible that in cases where there is an uncaptured error in the CTS, this will result in printing it twice, once from the CTS-installed hook and once from the cts_runner hook. If that turns out to be a big issue we can tweak this to disable the cts_runner hook when running the CTS.

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.

2 participants