test: Refactor mocha test infrastructure - #10309
Open
gonfunko wants to merge 9 commits into
Open
Conversation
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.
The basics
The details
Resolves
Proposed Changes
This PR refactors the Mocha test infrastructure. This change was LLM assisted with extensive manual review and edits. Reviewing commit by commit is recommended.
At a high level, this PR makes CI run the Mocha tests under node, and makes
npm run test:mocha:interactivemore convenient for day to day use by devs. More specifically:Mocha is copied from its resolved path in node_modules into the build/test directory and loaded from there. Mocha distributes pre-built browser versions, and their own guidance indicates that these should be used. Because the path is resolved, we don't hardcode node_modules anywhere.
Reason for Changes
This improves the speed and reliability of CI, since it no longer runs the test in a browser, improves developer experience when running tests with hot reload, improves reliability of tests (once we start moving them to Typescript), and removes a lot of complex code and hacks (importing modules by path).
Test Coverage
Tests continue to pass, both in the browser and in Node.