Add a test for the environment variable QUARTO_VERSION_REQUIREMENT #11245
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.
This is a follow up on 00249a4 which closed #10442
It adds a test from the error message when environment variable is set.
To be working it required to mock Deno.exit() in the test so that it throws an Error()
This is because after using
error()
,Deno.exit(1)
is called, and it makestest.execute()
quite with the rest of the test command to verify assertion.As a side note, this is possibly a problem as anytime this Deno.exit() happens, our test suite won't fail ! Test is not seen as Failed nor Success 🤷♂️
Our usual pattern seem to be throwing an error after
error()
so that our hooks trigger (the stack trace for example)Some examples:
quarto-cli/src/command/render/render-files.ts
Lines 512 to 516 in 60b8e01
quarto-cli/src/command/render/render-files.ts
Lines 522 to 526 in 60b8e01
quarto-cli/src/command/editor-support/crossref.ts
Lines 136 to 139 in 60b8e01
Though it is not the case everywhere. 🤷♂️ So probably not applying in this checking of quarto version requirement where we want to fail fast.
Using
Deno.exit(1)
completely stop execution andcatch()
does not applyquarto-cli/tests/test.ts
Lines 176 to 180 in 60b8e01
Anyhow, just a PR so that we have a test on the feature; Hopefully this is a good way to do it in our current test status.