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

ember-test never terminates with COVERAGE=true #81

Closed
lone-cloud opened this issue Nov 30, 2016 · 14 comments
Closed

ember-test never terminates with COVERAGE=true #81

lone-cloud opened this issue Nov 30, 2016 · 14 comments

Comments

@lone-cloud
Copy link

lone-cloud commented Nov 30, 2016

ember-cli: 2.10.0 ( also repro in previous version )
ember: 2.10.0
ember-cli-code-coverage: 0.38.0

ember t everything is good with no errors and proper termination. COVERAGE=true ember t everything succeeds and the coverage is generated as expected, but the process never terminates. When I run it in DEBUG="*" mode it seems to hang with:

  engine:ws writing "3" +0ms
  engine:ws received "2" +25s
  engine:socket packet +0ms
  engine:socket got ping +0ms
  engine:socket sending packet "pong" (undefined) +0ms
  engine:socket flushing buffer to transport +0ms
  engine:ws writing "3" +0ms
  engine:ws received "2" +25s
  engine:socket packet +0ms
  engine:socket got ping +0ms
  engine:socket sending packet "pong" (undefined) +0ms
  engine:socket flushing buffer to transport +0ms
  engine:ws writing "3" +0ms
  engine:ws received "2" +25s
  engine:socket packet +0ms
  engine:socket got ping +0ms
  engine:socket sending packet "pong" (undefined) +0ms
  engine:socket flushing buffer to transport +0ms
  engine:ws writing "3" +0ms

Looked into debugging phantom js but found no obvious errors.

@topaxi
Copy link

topaxi commented Nov 30, 2016

My builds stopped working with the same behaviour, it seemed to appear randomly. I guess this might be a dependency issue?

@rox163
Copy link

rox163 commented Nov 30, 2016

I've seen this as well but only with addons that have acceptance tests. If I skip the acceptance test then the run completes and reports coverage.

@lone-cloud
Copy link
Author

@rox163 Thank you! That was causing the freezing for me too.

@topaxi
Copy link

topaxi commented Dec 2, 2016

Are you by any chance using ember-cli-mirage?

I noticed that the request.onload callback never got called. This might be caused by pretenderjs (even though the request was made and I had a passthrough rule in mirage/config.js).

In my codebase in tests/helpers/destroy-app.js there was a missing line server.shutdown();.

Here the full file which solved the issue for me:

tests/helpers/destroy-app.js

import Ember from 'ember';

export default function destroyApp(application) {
  Ember.run(application, 'destroy');
  server.shutdown();
}

@lone-cloud
Copy link
Author

That was exactly my problem too. Thank you. 😲

@mdarmetko
Copy link

mdarmetko commented Dec 24, 2016

Still having this issue with version 0.3.9 even with the above solution. Reverting to 0.2.2 fixed it for me.

@lone-cloud
Copy link
Author

The issue is back for me with 0.3.9 but 0.3.8 is still good

@kategengler
Copy link
Collaborator

Hopefully solved by #87

@kategengler
Copy link
Collaborator

#87 has been released in 0.3.10

@ming-codes
Copy link
Contributor

Duplicates with #88?

@lone-cloud
Copy link
Author

I opened this ticket over a month before 88.
Anyways, the hanging issue is fixed for me after upgrading to 0.3.10 ( and previously having applied topaxi's fix ).

@mdarmetko
Copy link

Was still seeing this in 0.3.10. I'm using mostly default generated tests with ember 2.10 and ember-cli-mirage. It must have been a problem with a mirage instance never getting shutdown and hanging around. Resolved it by adding if(server !== undefined) { server.shutdown(); } to beforeEach and afterEach in each acceptance test file. As in,

module('Acceptance: Metro', {
  beforeEach: function() {
    if(server !== undefined) { server.shutdown(); }
    application = startApp();
    originalConfirm = window.confirm;
    window.confirm = function() {
      confirmCalledWith = [].slice.call(arguments);
      return true;
    };
  },
  afterEach: function() {
    Ember.run(application, 'destroy');
    window.confirm = originalConfirm;
    confirmCalledWith = null;
    if(server !== undefined) { server.shutdown(); }
  }
});

Hope this helps someone else having the same problem.

@isaacaskew
Copy link

isaacaskew commented Dec 27, 2017

@topaxi - that mirage server.shutdown() trick saved my ass. If you're ever in the Chicago area, your drink's on me.

@tniezurawski
Copy link

I had the same problem. Because of Integration tests where I use New Testing API.

I had to close mirage server (server.shutdown()) after every Integration tests. Here is quite neat solution for folks that will strugle with this in the future:

https://gist.github.com/tniezurawski/907d0fa83a7a621146add3871d1827ca

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

No branches or pull requests

8 participants