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

Prepare the test suite for the next Quarto release #21

Closed
rchaput opened this issue May 1, 2024 · 0 comments
Closed

Prepare the test suite for the next Quarto release #21

rchaput opened this issue May 1, 2024 · 0 comments

Comments

@rchaput
Copy link
Owner

rchaput commented May 1, 2024

Our tests fail against the "pre-release" of Quarto, because of the following error:

error: Uncaught SyntaxError: The requested module 'https://deno.land/std/streams/mod.ts' does not provide an export named 'writeAllSync'
import { writeAllSync } from "https://deno.land/std/streams/mod.ts";
         ^
    at <anonymous> (file:///home/runner/work/acronyms/acronyms/tests/run_tests.ts:14:10)

This is probably because the next version of Quarto embeds a new Deno version that no longer exports writeAllSync.
Deno 2.x has indeed removed this function, see the following links for more details:

Deno has been a pain in the *** since the test suite was created. However, its big advantage is that it is embedded within Quarto, so we are certain that the script can be executed (the problem is that, depending on Deno's version, our imports might not work.....).

I see three potential alternatives:

  • Fix the script and keep Deno. I am not sure that we can import from the standard library easily, because Quarto forbids "URL" imports, relying only on its local cache.
  • Ditch Deno and use a Lua script. Lua has the same advantage as Deno: it is embedded within Pandoc (=> within Quarto as well). However, the test suite might be difficult to write in Lua (?).
  • Ditch Deno and use a Python script. Python has one great advantage: it will be far easier to write. However, we have no guarantee that an interpreter will be available. It might not be a huge problem, we can ensure that an interpreter is installed on the CI/CD workflows. People who want to help develop and test acronyms will have to install a Python interpreter. It is very common on Unix/OSX systems.
rchaput added a commit that referenced this issue May 4, 2024
We previously used Deno, as it is embedded in Quarto (anyone can run the
script); however, Deno has given us all sorts of troubles (changing the
functions' names, changing imports, ...).

Quarto also supports Python scripts, although the interpreter must be
installed externally (but that should not be a problem, everyone has
Python, and CI/CD workflows can easily setup a Python interpreter).

This commit:

* Removes the Deno test script `run_tests.ts`.
* Replaces it with a new Python script `run_tests.py`.
* Automatically detects tests to perform instead of requiring to list
  them in the test script (see the `all_tests` variable).
* Adds information to the "short" reporting (single-line result on the
  command line), by indicating whether the return code is OK, the actual
  output equals the expected one, and the actual error equals the
  expected one. These details were previously only present in the
  Markdown summary.
* Adds an argument parser to support for various arguments in the
  future, instead of only considering arguments to be the tests names.
  We can still specify the tests to run as arguments, but more options
  can be made available.
* Update the test workflow (GitHub CI/CD) to setup Python and run the
  Python test script instead of the Deno one.

Solves #21
rchaput added a commit that referenced this issue May 4, 2024
We previously used Deno, as it is embedded in Quarto (anyone can run the
script); however, Deno has given us all sorts of troubles (changing the
functions' names, changing imports, ...).

Quarto also supports Python scripts, although the interpreter must be
installed externally (but that should not be a problem, everyone has
Python, and CI/CD workflows can easily setup a Python interpreter).

This commit:

* Removes the Deno test script `run_tests.ts`.
* Replaces it with a new Python script `run_tests.py`.
* Automatically detects tests to perform instead of requiring to list
  them in the test script (see the `all_tests` variable).
* Adds information to the "short" reporting (single-line result on the
  command line), by indicating whether the return code is OK, the actual
  output equals the expected one, and the actual error equals the
  expected one. These details were previously only present in the
  Markdown summary.
* Adds an argument parser to support for various arguments in the
  future, instead of only considering arguments to be the tests names.
  We can still specify the tests to run as arguments, but more options
  can be made available.
* Update the test workflow (GitHub CI/CD) to setup Python and run the
  Python test script instead of the Deno one.

Solves #21
rchaput added a commit that referenced this issue May 4, 2024
We previously used Deno, as it is embedded in Quarto (anyone can run the
script); however, Deno has given us all sorts of troubles (changing the
functions' names, changing imports, ...).

Quarto also supports Python scripts, although the interpreter must be
installed externally (but that should not be a problem, everyone has
Python, and CI/CD workflows can easily setup a Python interpreter).

This commit:

* Removes the Deno test script `run_tests.ts`.
* Replaces it with a new Python script `run_tests.py`.
* Automatically detects tests to perform instead of requiring to list
  them in the test script (see the `all_tests` variable).
* Adds information to the "short" reporting (single-line result on the
  command line), by indicating whether the return code is OK, the actual
  output equals the expected one, and the actual error equals the
  expected one. These details were previously only present in the
  Markdown summary.
* Adds an argument parser to support for various arguments in the
  future, instead of only considering arguments to be the tests names.
  We can still specify the tests to run as arguments, but more options
  can be made available.
* Update the test workflow (GitHub CI/CD) to setup Python and run the
  Python test script instead of the Deno one.

Solves #21
rchaput added a commit that referenced this issue May 4, 2024
We previously used Deno, as it is embedded in Quarto (anyone can run the
script); however, Deno has given us all sorts of troubles (changing the
functions' names, changing imports, ...).

Quarto also supports Python scripts, although the interpreter must be
installed externally (but that should not be a problem, everyone has
Python, and CI/CD workflows can easily setup a Python interpreter).

This commit:

* Removes the Deno test script `run_tests.ts`.
* Replaces it with a new Python script `run_tests.py`.
* Automatically detects tests to perform instead of requiring to list
  them in the test script (see the `all_tests` variable).
* Adds information to the "short" reporting (single-line result on the
  command line), by indicating whether the return code is OK, the actual
  output equals the expected one, and the actual error equals the
  expected one. These details were previously only present in the
  Markdown summary.
* Adds an argument parser to support for various arguments in the
  future, instead of only considering arguments to be the tests names.
  We can still specify the tests to run as arguments, but more options
  can be made available.
* Update the test workflow (GitHub CI/CD) to setup Python and run the
  Python test script instead of the Deno one.

Solves #21
@rchaput rchaput closed this as completed May 4, 2024
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

No branches or pull requests

1 participant