Closed amatiasq closed 1 year ago
What version of node did you test this against?
I was trying to merge this PR but I couldn't get it to work, I was testing under node 0.12.2.
@s9tpepper is the issue you were seeing that the execution of the tests seem to hang on 'require("adapter"] ...' line of the following code? That's the issue i'm seeing when i pull in @amatiasq changes.
I ran through a little debug but couldn't get too the bottom of it. Adapter is indeed loaded but somewhere in the require call stack things seem to go into the void. Any thoughts on this? I really like the Karma integration and I'll be sad if i have to go and roll my own solution.
(function (global) {
global.__karma__.loaded = function () {
require(["adapter"], function (Adapter) {
Adapter().start();
});
};
})(window);
It's all explained on this comment
The code depends on a race condition. The adapter starting point is executed immediately trusting than karma will have test ready before require's timeout callback is executed. A simple solution was to put adapter starting point inside
__karma__.loaded
which is a callback defined for this case.I don't know how to create a test for a race condition so no new test was added.