Testing is useful in a project like this to help to prevent bugs and regressions caused by changes. At this current moment in time, a good chunk of unit and all integration tests are broken.
Integration tests appear to be broken due to the testing tool (Node TAP) not being properly configured for Webpack (somehow). Whereas most broken unit tests are broken because they're attempting to access browser APIs (mainly window and location, but DOMParser is an issue in one part).
location (aliased as window.location) is referenced inside of src/extension-support/extension-manager.js
https://github.com/PenguinMod/PenguinMod-vm/blob/develop/src/extension-support/extension-manager.js#L11-L13
Whereas window is being referenced throughout src/util/sandboxed-javascript-runner.js.
DOMParser is used in src/engine/adapter.js.
https://github.com/PenguinMod/PenguinMod-vm/blob/develop/src/engine/adapter.js#L170-L183
Node TAP may not be compatible with these APIs, as it appears to be focused mainly on Node rather than the browser. I don't think the solution is to remove the browser APIs, the solution, instead, is to find an appropriate testing environment that can and will work.
Testing is useful in a project like this to help to prevent bugs and regressions caused by changes. At this current moment in time, a good chunk of unit and all integration tests are broken.
Integration tests appear to be broken due to the testing tool (Node TAP) not being properly configured for Webpack (somehow). Whereas most broken unit tests are broken because they're attempting to access browser APIs (mainly
windowandlocation, butDOMParseris an issue in one part).location(aliased aswindow.location) is referenced inside ofsrc/extension-support/extension-manager.jshttps://github.com/PenguinMod/PenguinMod-vm/blob/develop/src/extension-support/extension-manager.js#L11-L13
Whereas
windowis being referenced throughoutsrc/util/sandboxed-javascript-runner.js.DOMParseris used insrc/engine/adapter.js.https://github.com/PenguinMod/PenguinMod-vm/blob/develop/src/engine/adapter.js#L170-L183
Node TAP may not be compatible with these APIs, as it appears to be focused mainly on Node rather than the browser. I don't think the solution is to remove the browser APIs, the solution, instead, is to find an appropriate testing environment that can and will work.