Browser Test Setup: How To Make Already Global Systemjs Module Available To Require('systemjs') Of Tested Code?
I have code that is fairly system independent and with few system dependent lines of code runs on node.js or the browser. I already managed to setup mocha-based testing so that it
Solution 1:
I solved it myself:
I had to go to the source code of SystemJS to find the answer. The problem seems to be that the SystemJS
symbol wasn't just a plain object like it normally is, where the methods are properties directly inside this object. Instead, SystemJS
is an instance and the methods are on the prototype.
What finally worked was taken right from how SystemJS used newModule
internally, and the final command that worked was
SystemJS.registry.set(
'systemjs',
SystemJS.newModule({default: SystemJS, __useDefault: true})
);
This replaces the line under // THIS DOES NOT WORK:
in the above index.html
test runner file.
Post a Comment for "Browser Test Setup: How To Make Already Global Systemjs Module Available To Require('systemjs') Of Tested Code?"