Skip to content

Mocha phantom addon coverage issue in master causing a global error. #32

Closed

Description

@lukesargeant

Hi guys, while trying out #31 using:

ember-cli: 2.7.0
node: 0.12.6
os: darwin x64
phantomjs: 1.9.8

I (accidentally) tried out the current master and started having a problem with a global error. After a bit of digging it seems that f2ba0e8 causes a broken test on a fresh addon, with just ember-cli-mocha installed when running Coverage=true ember test

ok 1 PhantomJS 1.9 - JSHint | app.js should pass jshint
ok 2 PhantomJS 1.9 - JSHint | helpers/destroy-app.js should pass jshint
ok 3 PhantomJS 1.9 - JSHint | helpers/module-for-acceptance.js should pass jshint
ok 4 PhantomJS 1.9 - JSHint | helpers/resolver.js should pass jshint
ok 5 PhantomJS 1.9 - JSHint | helpers/start-app.js should pass jshint
ok 6 PhantomJS 1.9 - JSHint | resolver.js should pass jshint
ok 7 PhantomJS 1.9 - JSHint | router.js should pass jshint
ok 8 PhantomJS 1.9 - JSHint | test-helper.js should pass jshint
not ok 9 PhantomJS 1.9 - Global error: INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable. at http://localhost:7357/8472/tests/index.html?hidepassed, line 48
    ---
        Log: |
            { type: 'error',
              text: 'INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable. at http://localhost:7357/8472/tests/index.html?hidepassed, line 48\n' }

After a quick look at the changes in the commit mentioned above, I found that by removing:

request.send(data);
request.responseType = 'json';

... and moving callback() out of the onload handler, it ran without error, but I'm not sure how a proper fix should look.

The tests run fine in Chrome, and are also fine without specifying COVERAGE=true.

[EDIT] Phantomjs 2.1 seems to have the same issue, but doesn't log the error - it just hangs after test 8.

Activity

  1. kategengler commented on Sep 15, 2016

    @kategengler
    Collaborator

    Removing those lines will mean that coverage does not get written.

    For a workaround for now, I highly recommend not using Phantom. These kinds of issues where Phantom behaves differently than any real browser crop up all the time and it's just not worth the time to debug them when no end-user is using Phantom as a browser.

  2. rwjblue commented on Sep 15, 2016

    @rwjblue
    Collaborator

    Can you console.log(data) to see if it is somehow invalid (I'm thinking of escaping issues or something from Mocha)?

  3. GCheung55 commented on Sep 18, 2016

    @GCheung55

    Maybe try seeing if it's reproducible in Safari?

  4. rwjblue commented on Oct 7, 2016

    @rwjblue
    Collaborator

    I believe this was fixed in #43 (thanks to @dfreeman's excellent sleuthing skills).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions