Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

onComplete does not allow for a blocking callback #1944

Closed
Jeff-Symphony opened this issue Mar 18, 2015 · 3 comments
Closed

onComplete does not allow for a blocking callback #1944

Jeff-Symphony opened this issue Mar 18, 2015 · 3 comments

Comments

@Jeff-Symphony
Copy link

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);
    }
};
@juliemr
Copy link
Member

juliemr commented Mar 18, 2015

You're right, onComplete was never set up to wait to return a promise, and is not documented and having that option. It's confusing because onPrepare and onCleanUp can return a promise and it will wait.

We should

  1. Improve docs about this
  2. Consider making onComplete wait for promises (this will require changes to all framework runners)

@vikasgahlaut
Copy link

Any updates on this issue. I am also trying to use nodemailer in onComplete event but it is not working or is there any workaround?

@sjelin sjelin assigned sjelin and unassigned juliemr Jan 26, 2016
sjelin added a commit to sjelin/protractor that referenced this issue Jan 30, 2016
sjelin added a commit to sjelin/protractor that referenced this issue Jan 30, 2016
sjelin added a commit to sjelin/protractor that referenced this issue Jan 30, 2016
sjelin added a commit to sjelin/protractor that referenced this issue Feb 1, 2016
sjelin added a commit to sjelin/protractor that referenced this issue Feb 1, 2016
@vikas2future
Copy link

Hi All, We are using jasmine-reporters for generating both HTML as well as XML reports. However we have written a custom dot net console application to take the XML reports generated and write it back to Microsoft Test Manager. If i try to invoke a console application within the IT block of a spec file it invokes fine. However when we try to invoke the console application from OnComplete event(as XML reports would be generated by now) in conf.js it is not invoking at all. Kindly advise.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants