Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grunt-contrib-jasmine and PhantomJS security

I'm getting an error

XMLHttpRequest cannot load https://my-api.domain.com. Origin file:// is not allowed by Access-Control-Allow-Origin.

when I try to run some async unit tests that query an API through grunt-contrib-jasmine, which in turn using PhantomJS. I see that the command line version of PhantomJS does have a 'web-security' options. Can I control how grunt-contrib-jasmine uses PhantomJS to include this option and disable the cross-domain security?

like image 217
nicholas Avatar asked May 30 '13 00:05

nicholas


1 Answers

You can pass options to phantomjs similarly to how you would on the command line, e.g.

The following options may help, but more can be found at the phantomjs docs

jasmine : {
  your_task : {
    options : {
      '--web-security' : false,
      '--local-to-remote-url-access' : true,
      '--ignore-ssl-errors' : true
    }
  }
}
like image 188
jsoverson Avatar answered Oct 23 '22 23:10

jsoverson