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

Tester: some possible improvements #66

Open
northword opened this issue Dec 13, 2024 · 1 comment
Open

Tester: some possible improvements #66

northword opened this issue Dec 13, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@northword
Copy link
Owner

1. Mocha Framework on the User Side

Currently, when running the Tester, the latest version of Mocha is downloaded from JsDelivr, which could lead to potential errors. It would be better if either the user installs Mocha or the scaffold manages its version:

  • User-managed: Users manually install Mocha and Chai. During runtime, the scaffold copies mocha.js from node_modules to the Test Plugin Directory.
  • Scaffold-managed: The scaffold directly bundles Mocha or programmatically controls the installation of dependencies on the user's side.

Since the scaffold includes methods to set up Mocha, the version of Mocha obtained on the user side should remain consistent with the one supported by the scaffold.

2. Test Cases May Not Need Compilation into a Single File

The example provided at Mocha's official documentation suggests:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Mocha Tests</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
  </head>
  <body>
    <div id="mocha"></div>

    <script src="https://unpkg.com/chai@4/chai.js"></script>
    <script src="https://unpkg.com/mocha/mocha.js"></script>

    <script class="mocha-init">
      mocha.setup('bdd');
      mocha.checkLeaks();
    </script>
    <script src="test.array.js"></script>
    <script src="test.object.js"></script>
    <script src="test.xhr.js"></script>
    <script class="mocha-exec">
      mocha.run();
    </script>
  </body>
</html>

It seems feasible to include each test file separately.

3. Rerunning Tests After Source/Test Code Reload

The current ZoteroRunner already supports reloading multiple plugins or specific ones. Therefore, it is possible to implement the following workflow:

  • Source code changes → Recompile plugin → Reload plugin → Reload test plugin
  • Test code changes → Reload test plugin

Test-related content should be moved out of the dist directory.

@northword northword added the enhancement New feature or request label Dec 13, 2024
@windingwind
Copy link
Collaborator

Agree with all three points

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants