nathanboktae / mocha-phantomjs

:coffee: :ghost: Run client-side mocha tests in the command line through phantomjs
MIT License
954 stars 112 forks source link

Weird error based on running location #168

Closed krasimir closed 9 years ago

krasimir commented 9 years ago

My TestRunner.html is placed in a tests folder. If I call mocha-phantomjs tests/TestRunner.html everything is fine. However, if I go to the tests folder and run mocha-phantomjs ./TestRunner.html I got

Failed to use load and use the custom reporter ...../code/todomvc/backbone/tests/spec.js
Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///usr/local/lib/node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee. Domains, protocols and ports must match.
nathanboktae commented 9 years ago

Looks like its similar to #167. Do you have a mocha-phantomjs.opts file in one folder vs. another? What about TestRunner.html vs. ./TestRunner.html?

krasimir commented 9 years ago

Hello,

a) Nope, I don't have mocha-phantomjs.opts file. b) I tried both TestRunner.html and ./TestRunner.html. The result is the same.

Are you able to reproduce the problem. Maybe it is something with my local setup.

cfmeyers commented 9 years ago

I'm having the same issue. Running mocha-phantomjs 3.5.3, phantomjs 1.9.8, and I have no mocha-phantomjs.opts file.

nathanboktae commented 9 years ago

What if you invoke phantom directly?

phantomjs your/path/to/lib/mocha-phantomjs.coffee TestRunner.html
cdaringe commented 9 years ago

@nathanboktae--it renders the same error :(

nathanboktae commented 9 years ago

Yeah I don't have enough information to help you. A publicly available reproduction of this issue would be appreciated.

callumacrae commented 9 years ago

Here we go, failing in this repo:

https://github.com/callumacrae/whtevr https://travis-ci.org/callumacrae/whtevr

Failing both locally and on Travis.

callumacrae commented 9 years ago

@nathanboktae Are you able to replicate? I'm getting the same error on another repo.

callumacrae commented 9 years ago

I think my issue was caused by calling mocha.run() when I wanted to call mochaPhantomJS.run().

https://github.com/callumacrae/whtevr/commit/0370bf6c14346b437075a319e203edc17b5befe2

nathanboktae commented 9 years ago

Closing as a dupe of #167