Skip to content

TypeError: Cannot call method 'emit' of undefined #11

@rmarlow

Description

@rmarlow

I'm testing some code of mine that seems to have an error in it. It works fine in a browser, but it errors in node-qunit-phantomjs. When the error is thrown though, my error results in another error within node-qunit-phantomjs, like so:

root@local-dev:/path/to/tests# node-qunit-phantomjs mytest.js.html
Testing /path/to/tests/mytest.js.html

/usr/lib/node_modules/node-qunit-phantomjs/index.js:67
                this.emit('error', new Error(e));
                     ^
TypeError: Cannot call method 'emit' of undefined
    at /usr/lib/node_modules/node-qunit-phantomjs/index.js:67:22
    at ChildProcess.exithandler (child_process.js:646:7)
    at ChildProcess.emit (events.js:117:20)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Looking at the source, the "this" keyword seems to not be pointing at what it thinks it is. I'm going to proceed trying to debug my own code for what is throwing the original error, but do you have any clues as to why the "this" keyword is not in the correct scope here, or a possible fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions