This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
onComplete does not allow for a blocking callback #1944
Closed
Description
I'm trying to implement an asynchronous action (Nodemailer) during the onComplete
of my test config. I found that while the action starts, onComplete would finish and kill the runner before the action completed.
In order to get onComplete
working for me using a deferred promise, I needed to modify the lib/framework/jasmine.js
as such:
jasmineNodeOpts.onComplete = function(jasmineRunner, log) {
try {
if (originalOnComplete) {
originalOnComplete(jasmineRunner, log).then(resolveOnComplete);
}else{
resolveOnComplete();
}
function resolveOnComplete(){
resolve({
failedCount: jasmineRunner.results().failedCount,
specResults: testResult
});
}
} catch (err) {
reject(err);
}
};