google / blockly-samples

Plugins, codelabs, and examples related to the Blockly library.
http://github.com/google/blockly
Apache License 2.0
830 stars 614 forks source link

Simplify test build/run process for plugin mocha tests #949

Open cpcallen opened 2 years ago

cpcallen commented 2 years ago

Category

Component

Is your feature request related to a problem? Please describe.

Issue #902 occurred (in part) because dev-scripts/scripts/test.js compiles each 1-20 KiB tests/*.mocha.js test file into a 17–25 MiB webpack'd monstrosity in build/, each containing a complete copy of all of its dependencies (including the whole of blockly_compressed.js et al.), and then these files are required and executed one at a time (but in the same invocation of node.

This seems to have several disadvantages:

Nevertheless, this arrangement was set up for various reasons, including (as I understand it):

Describe the solution you'd like

I think it would be worth trying to revise the test runner for these tests with a view to achieving the following (in order of priority):

  1. Don't load more than one instance of Blockly in a given JS engine invocation.
  2. Run the tests (including any needed build process) as quickly as possible.
  3. Make the test running machinery as simple and easy to understand as possible.

Describe alternatives you'd like to see considered

Additional context

See #902.

BeksOmega commented 2 years ago

I think we need to bump mocha to v10 and drop node 12 support before we remove the build step. My understanding is mocha uses node to run our code, and node doesn't support esmodules until >=13.