Open lupestro opened 2 years ago
I had submitted an issue to Mocha for the problems with critical mocha properties being overwritten by window properties of the same name, and they fixed it and published the fix. Today, I updated my PR to use the latest version of mocha, which includes the fix, rather than my tweaked earlier version. I've tested it with the included tests and the tests I've written for my own module. This should be good to go if somebody wants to publish it.
I did some debugging and spelunking into mocha.js and determined the root cause of the problem that led to all that wobbly globalThis code. The window had a ui property that was overwriting the mocha.ui property during an Object.assign merge. After that, mocha was unable to initialize. I provided a three-line tweak to the end of mocha.js to carve that one property out of the way without damaging window itself. Then Quench was able to load using mocha in the usual way as an import at the top of the module. (This required an update to mocha 9.x as well.)
I adjusted the code in quench-init.js accordingly, did a couple of cleanups there, and bumped mocha and chai to their latest versions. Everything seems to be working well now but feel free to check it.