angular-recaptcha
angular-recaptcha copied to clipboard
Q: how to run test cases?
Apologies if I missed something.
I am about to create a pull request and wanted to run the test cases in advance, but grunt test
gives me this output:
Running "karma:unit" (karma) task
19 04 2017 10:27:22.699:WARN [watcher]: Pattern "/home/usr/angular-recaptcha/bower_components/angular/angular.js" does not match any file.
19 04 2017 10:27:22.701:WARN [watcher]: Pattern "/home/usr/angular-recaptcha/bower_components/angular-mocks/angular-mocks.js" does not match any file.
19 04 2017 10:27:22.781:INFO [karma]: Karma v1.6.0 server started at http://0.0.0.0:9876/
19 04 2017 10:27:22.781:INFO [launcher]: Launching browser Chrome with unlimited concurrency
19 04 2017 10:27:22.787:INFO [launcher]: Starting browser Chrome
19 04 2017 10:27:23.361:INFO [Chrome 57.0.2987 (Linux 0.0.0)]: Connected on socket Ki8CrYvAsy6qL70mAAAA with id 66299035
Chrome 57.0.2987 (Linux 0.0.0) ERROR
Uncaught ReferenceError: angular is not defined
at src/module.js:9
Warning: Task "karma:unit" failed. Use --force to continue.
In other words, the module.js
file expects a global object named angular
which is not available in Chrome at runtime.
This is a sample config I've got:
Might it be that Karma is expecting that angular and angular-mocks are loaded with commonJS or so? and that the bower_components are not standalone scripts?
edit Looking at the travis.yml, that tells travis to execute the tests noticed that it executes:
grunt karma:ci
and grunt coverage
. Maybe using these it works?
PS: what else do you suggest to test before opening a PR? I mean, given that reCaptcha does not work on localhost, the options seem quite limited ...
reCaptcha does work on localhost, you just need to provide your own reCaptcha key which has localhost defined as a domain.
Also, did you run npm install
and bower install
?