angular-recaptcha icon indicating copy to clipboard operation
angular-recaptcha copied to clipboard

Q: how to run test cases?

Open rondonjon opened this issue 7 years ago • 3 comments

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.

rondonjon avatar Apr 19 '17 08:04 rondonjon

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?

DanielaValero avatar Apr 19 '17 12:04 DanielaValero

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 ...

rondonjon avatar Apr 19 '17 12:04 rondonjon

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?

TheSharpieOne avatar Apr 19 '17 15:04 TheSharpieOne