Repository navigation
Conversation
testament and docgen already check `findNodeJs() == ""`, but findNodeJs raised IOError, so a missing NodeJS stopped the whole testament category. `nim js -r` now reports the missing NodeJS itself.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #26716
testament/testament.nimandcompiler/docgen.nimcheckfindNodeJs() == ""and handle a missing NodeJS there (testament fails the JS test with "nodejs binary not in PATH", docgen skips JS runnableExamples). But since #18978findNodeJsraisesIOErrorinstead of returning"", so those branches never run: testament stops at the first JS test of the category and leavestestresults/<category>.jsonunclosed, andnim doc --backend:json a file with runnableExamples crashes.Fix:
findNodeJsreturns""when NodeJS is not found, as before #18978.nim js -r, the only caller that relied on the exception, now reports the missing NodeJS itself withrawMessage(errGenerated). The alternative was to catch the exception in testament, but that would leave the same crash in docgen.Verification, on macOS arm64, with NodeJS removed from
PATH(env -i PATH=<nim bin>:/usr/bin:/bin:/usr/sbin:/sbin):testament cat let: before, it stopped attests/let/timportc.nim jswithError: unhandled exception: NodeJS not found in PATH [IOError], and 3 of the 7 tests ran. After, all 7 run,timportc.nim jsfails withnodejs binary not in PATH(reExeNotFound), andlet.jsonis valid JSON.nim js -r a.nim:Error: NodeJS not found in PATH; please install it first, see https://nodejs.org/en/download, exit code 1, no stack trace.nim doc --backend:json a file with a runnableExample: before, theIOErrorcrash; after, exit code 0 and the HTML is written.With NodeJS in
PATH,testament cat letpasses all 7 (including the JS test), andnim js -randnim doc --backend:jsrun the code with node as before.