Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter onBrowserComplete without onBrowserStart #945

Closed
vojtajina opened this issue Mar 11, 2014 · 5 comments
Closed

Reporter onBrowserComplete without onBrowserStart #945

vojtajina opened this issue Mar 11, 2014 · 5 comments

Comments

@vojtajina
Copy link
Contributor

It is possible this happens, if browser errors/crashes/get timeout-ed before firing "start" (start happens after all the specs are loaded and test framework kicks off the execution).

Reporters don's expect this, for instance junit reporter creates "xml" object per browser in onBrowserStart and then assumes it is there in onBrowserComplete. Similar happens with coverage reporter and probably many others.

I suggest to handle this in lib/browser.js, if a browser tries to emit "complete" without "start", we should emit "start" event first.

@sylvain-hamel
Copy link
Contributor

@vojtajina FYI: I submitted PR karma-runner/karma-junit-reporter#17 to fix that in the junit reporter before I saw this issue here.

@vojtajina
Copy link
Contributor Author

That's all right. But we should still fix it in karma core.

@dignifiedquire
Copy link
Member

Closing due to inactivity

@arobinson
Copy link

This is still an issue and we can reproduce the issue in a Jenkins run. I debugged the karma-junit-reporter code and found that when it doesn't write the report, its initializeXmlForBrowser is never executed.

This function is called by:

  // "run_start" - a test run is beginning for all browsers
  this.onRunStart = function (browsers) {
    // TODO(vojta): remove once we don't care about Karma 0.10
    browsers.forEach(initializeXmlForBrowser)
  }

  // "browser_start" - a test run is beginning in _this_ browser
  this.onBrowserStart = function (browser) {
    initializeXmlForBrowser(browser)
  }

So we have hit this use case where onBrowserStart is not invoked, but onBrowserComplete is invoked.

@arobinson
Copy link

Can this be re-opened or should a new issue be filed? Not sure why this was closed without the issue being addressed.

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

No branches or pull requests

4 participants