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

compiler: don't raise when NodeJS is missing #812

Merged

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jul 25, 2023

Summary

Don't raise an exception when the NodeJS executable cannot be found.
In case that NodeJS is missing, this fixes:

  • using the documentation generator with the JS backend crashing the
    compiler when a runnableExample is encountered
  • testament aborting a category when attempting to run the first JS
    test

In addition, this also means that the compiler now exits with a proper
error instead of crashing because of an unhandled exception.

Details

This is a revert of commit 0ae2d1e.
Except for one, all callsites of findNodeJS expect an empty string in
case a NodeJS installation cannot be found and use that information to
handle the error themselves: docgen handles it by not running
runnableExamples and testament treats and reports the affected test
as failed.

The only place where a missing NodeJS installation wasn't handled, and
what the reverted commit intended to fix, is the processing of the run
(or -r) option. There, the path is now verified to not be empty and an
error is reported (via logError) if it is.

Summary
=======

Don't raise an exception when the NodeJS executable cannot be found.
In case that NodeJS is missing, this fixes:
- using the documentation generator with the JS backend crashing the
  compiler when a `runnableExample` is encountered
- `testament` aborting a category when attempting to run the first JS
  test

In addition, this also means that the compiler now exits with a proper
error instead of crashing because of an unhandled exception.

Details
=======

This is a revert of commit 0ae2d1e.
Except for one, all callsites of `findNodeJS` expect an empty string in
case a NodeJS installation cannot be found and use that information to
handle the error themselves: `docgen` handles it by not running
`runnableExamples` and `testament` treats and reports the affected test
as failed.

The only place where a missing NodeJS installation wasn't handled, and
what the reverted commit intended to fix, is the processing of the `run`
(or `-r`) option. There, the path is now verified to not be empty and an
error is reported (via `logError`) if it is.
@zerbina zerbina added bug Something isn't working compiler General compiler tag tool Improvements to non-compiler tooling labels Jul 25, 2023
@zerbina zerbina added this to the Tooling milestone Jul 25, 2023
@zerbina
Copy link
Collaborator Author

zerbina commented Jul 25, 2023

/merge

@github-actions
Copy link

Merge requested by: @zerbina

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

  • I discovered this after noticing that testament doesn't run tests properly if NodeJS is missing

@chore-runner chore-runner bot added this pull request to the merge queue Jul 25, 2023
Merged via the queue into nim-works:devel with commit d6cd0f9 Jul 25, 2023
18 checks passed
@zerbina zerbina deleted the dont-raise-when-missing-nodejs branch July 25, 2023 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler General compiler tag tool Improvements to non-compiler tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants