ryscheng / karma-cordova-launcher Goto Github PK
View Code? Open in Web Editor NEWA Karma plugin. Launch on Apache Cordova
A Karma plugin. Launch on Apache Cordova
Hello.
I am trying to setup karma in order to unit test my cordova/ionic hybrid app, and I'm getting errors due to plugins not working, specifically, I'm getting undefined errors with cordova-plugin-network-information. Your documentation states that plugins should be written using a namespace (?) syntax, such as
'org.apache.cordova.console'
which I personally find odd since during the time I've worked with hybrid apps and cordova plugins everyone uses the dashes syntax:
'cordova-plugin-console',
If the former syntax is the right one, how are we supposed to find out or get the correct plugin names if everyone uses the latter?
Thanks
To reproduce:
Within my project I had run cordova prepare
for 3 platforms, which appeared in my project-root/platforms
folder.
Unexpected behavior:
Executing karma attempts to test all 3 platforms, even though my command line outputs Launching browser Cordova with unlimited concurrency using settings: ( platforms: [ 'android' ], ...
Workaround:
If I manually delete the extra 2 folders, karma correctly tests only 1 platform.
How should I go about testing whether my Cordova startup code is working correctly? The events never get fired! Shall I call the handlers manually? Any hint is appreciated.
Regards,
Martin
Using karma 1.1.0 i can't run unit tests with exact configuration as in readme.md
This is the error i get when i run karma start
:
10 07 2016 04:07:12.139:INFO [launcher]: Starting browser undefined on Cordova 10 07 2016 04:07:12.140:ERROR [karma]: [TypeError: browser.on is not a function] TypeError: browser.on is not a function at Object.j (D:\lab\app\node_modules\karma\lib\launcher.js:96:17) at Object.setTimeout.bind.j (D:\lab\app\node_modules\qjobs\qjobs.js:143:18) at Timer.listOnTimeout (timers.js:92:15) !!!EXITING!!!
Hi, thanks for this very cool plugin!
One simple thing, though, would make it even more useful: instead of just emulating, also use the "run" mode. The Android emulator is known to be horribly slow, and things like Genymotion allow a much faster interaction, but they work as pseudo-real devices. In addition, in some scenarios you would also prefer a physical device instead of emulated ones.
The change is minimal: in index.js, line 97, instead of using a fixed word "emulate", it would be good to have a parameter from the settings that can be either "emulate" or "run".
Also, as Genymotion or real devices don't use the standard loopback address 10.0.2.2, on line 65, we would need to specify a different address (10.0.3.2 for Genymotion for example). Again, the address could be set in the settings of the plugin. I could clone this project and make the changes myself, but it would be nice if these are done "officially" in your repository.
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.