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

Object [object Object] has no method 'on' #10

Open
DanielApt opened this issue Apr 21, 2016 · 9 comments
Open

Object [object Object] has no method 'on' #10

DanielApt opened this issue Apr 21, 2016 · 9 comments

Comments

@DanielApt
Copy link

DanielApt commented Apr 21, 2016

I'm trying to set up some automated tests with Karma, and want to run tests against my IE VMs.

Currently it's very basic, with only one test checking if true equals true.

Even in this very basic scenario it fails with the following error:

TypeError: Object [object Object] has no method 'on'
    at /Users/danielapt/Desktop/auto-tests/node_modules/karma/lib/launcher.js:95:17
    at next (/Users/danielapt/Desktop/auto-tests/node_modules/karma/node_modules/batch/index.js:118:7)
    at Batch.end (/Users/danielapt/Desktop/auto-tests/node_modules/karma/node_modules/batch/index.js:154:5)
    at launch (/Users/danielapt/Desktop/auto-tests/node_modules/karma/lib/launcher.js:111:11)
    at invoke (/Users/danielapt/Desktop/auto-tests/node_modules/karma/node_modules/di/lib/injector.js:75:15)
    at Server.<anonymous> (/Users/danielapt/Desktop/auto-tests/node_modules/karma/lib/server.js:171:24)
    at Server.g (events.js:180:16)
    at Server.emit (events.js:92:17)
    at net.js:1056:10
    at process._tickCallback (node.js:448:13)

The on that seems to not exist is defined inside karma's launcher.js:96

What should I do? I do notice the VM being opened, but nothing seems to happen once it has been opened. Please let me know if you need any further info.

@DanielApt DanielApt changed the title Test isn't running Object [object Object] has no method 'on' Apr 21, 2016
@niksy
Copy link

niksy commented May 1, 2016

Having the same error:

TypeError: browser.on is not a function
    at /Users/niksy/Projects/karma-test/node_modules/karma/lib/launcher.js:95:17
    at next (/Users/niksy/Projects/karma-test/node_modules/karma/node_modules/batch/index.js:118:7)
    at Batch.end (/Users/niksy/Projects/karma-test/node_modules/karma/node_modules/batch/index.js:154:5)
    at launch (/Users/niksy/Projects/karma-test/node_modules/karma/lib/launcher.js:111:11)
    at invoke (/Users/niksy/Projects/karma-test/node_modules/karma/node_modules/di/lib/injector.js:75:15)
    at Server.<anonymous> (/Users/niksy/Projects/karma-test/node_modules/karma/lib/server.js:171:24)
    at Server.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at Server.emit (events.js:166:7)
    at emitListeningNT (net.js:1262:10)
    at nextTickCallbackWith1Arg (node.js:426:9)
    at process._tickCallback (node.js:348:17)

@DanielApt
Copy link
Author

@xdissent Looks like it's not just me, and has been verified by another user. I believe this issue is now worth addressing.

If there's anything I can do to help, please let me know.

@hbeaufils
Copy link

Same thing for me using Karma 0.13.22

@lucasfcosta
Copy link

This is happening to me too

@mjbradford89
Copy link

Getting the same issue on Karma 0.13.2

@jhuesos
Copy link

jhuesos commented Jul 18, 2016

The project hasn't been updated for a year.... I am not holding my breath for a fix :(

@niksy
Copy link

niksy commented Aug 18, 2016

@DanielApt @hbeaufils @lucasfcosta @mjbradford89 @jhuesos If anyone’s interested, I’ve managed to get it working: https://github.com/niksy/karma-ievms/tree/browser-decorator

Since I don’t know CoffeeScript, I’ve fixed it in transpiled code, so if anyone want’s to transfer it to CoffeeScript and make PR to main repo, fire away :)

What was the problem? I was looking at already existing launchers and saw that all those launchers inherit baseBrowserDecorator which has all necessary lifecycle methods. That decorator is available if you inject default arguments. After that, everything was working mostly OK, but there was also forceKill method missing so I added that which just calls kill method and waits for it’s return signal (Promise).

Also, methods can’t be defined on prototype, but must be initiated on every instance creation.

Also, I’ve taken time to implement default logger so you can get terminal output of different VM lifecycle events (open VM, close and stop VM).

Hope it helps you!

@guillaumevincent
Copy link

guillaumevincent commented Oct 6, 2016

@niksy this works and fix the error for me :

npm install 'git+https://github.com/niksy/karma-ievms.git#browser-decorator' --save-dev

@markfeimer
Copy link

@niksy Thanks for the fix, it works like a charm!

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