Closed leeyi45 closed 7 months ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/cse-machine/interpreter.ts | 1 | 2 | 50.0% | ||
src/name-extractor/index.ts | 28 | 29 | 96.55% | ||
src/utils/misc.ts | 3 | 4 | 75.0% | ||
src/modules/loader/index.ts | 16 | 18 | 88.89% | ||
src/runner/sourceRunner.ts | 4 | 6 | 66.67% | ||
src/modules/loader/loaders.ts | 54 | 62 | 87.1% | ||
src/stepper/stepper.ts | 4 | 16 | 25.0% | ||
<!-- | Total: | 282 | 309 | 91.26% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/utils/statementSeqTransform.ts | 1 | 14.29% | ||
src/modules/utils.ts | 1 | 88.24% | ||
src/cse-machine/utils.ts | 1 | 89.61% | ||
src/modules/errors.ts | 2 | 75.71% | ||
src/validator/validator.ts | 2 | 95.21% | ||
src/cse-machine/interpreter.ts | 7 | 91.59% | ||
<!-- | Total: | 14 | --> |
Totals | |
---|---|
Change from base Build 8549384100: | 0.05% |
Covered Lines: | 10615 |
Relevant Lines: | 12638 |
This PR will officially deprecate and remove any synchronous module loading code. All module code is completely asynchronous.
The main idea is to leverage the native
import()
functions that browsers provide. However this is not available in Jest or NodeJS, so it is necessary to detect the environment and switches to usingrequire
when not running in the browser.And even then, though Jest will have no problems with it, some testing has shown that NodeJS will refuse to load JSON files over the web (i.e trying to import
http://localhost:8022/modules.json
throwsMODULE_NOT_FOUND
), so JSON files are still loaded usingfetch
.This does introduce complexity into how our tests are written (and perhaps in some other areas that I cannot foresee), so maybe it would be best to simply use the
fetch
theneval
method, but why not useimport()
where we can?This is fairly low priority, so it doesn't really need to merged ahead of anything else
Will close #1348