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

Worker threads fixes and SourceMap revamp #1666

Merged
merged 5 commits into from
Dec 31, 2024
Merged

Worker threads fixes and SourceMap revamp #1666

merged 5 commits into from
Dec 31, 2024

Conversation

edemaine
Copy link
Collaborator

@edemaine edemaine commented Dec 30, 2024

Worker threads (CIVET_THREADS feature) was broken in a few ways:

  • Errors weren't serialized, so we got the empty {} exception if there was an error
  • errors option didn't properly modify the array
  • SourceMap outputs were crashing when serializing into a worker response message (because of function properties), which caused an error (see below). This caused yarn test to fail (before Parallel testing via CIVET_THREADS (Mocha's --parallel) #1665), and also caused civet filename.civet to fail. 🙀

Internal API change: SourceMap is now a class. This seems cleaner overall, and helps with serialization for worker messages. But it changes the API:

  • Instead of SourceMap(source) we need to use new SourceMap(source).
  • lines etc. are properties instead of part of the data field. In code that deals with multiple versions of Civet (e.g. LSP), I included a fallback for the old format.
  • source is now a property, not a function. I don't think we use it anywhere though.
  • updateSourceMap needs to be binded

Also the ESM register plugin tells you which file is erroring (which has been an issue in the past).

Also a small fix so that CIVET_THREADS=0 yarn test disables Mocha's parallel mode (to bypass export CIVET_THREADS=4). Previously 0 was treated as truthy.

BREAKING CHANGE: Must update VSCode plugin to 0.3.27 and eslint plugin to 0.0.6

Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

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

Thanks! We're finally migrating away from the CoffeeScript circa 2011 coding style :P

@edemaine edemaine merged commit 0ae2cdd into main Dec 31, 2024
3 of 4 checks passed
@edemaine edemaine deleted the worker-fixes branch December 31, 2024 13:34
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