Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined coverage result possibly caused by browser security #23

Closed
juriejan opened this issue Mar 27, 2014 · 5 comments
Closed

Undefined coverage result possibly caused by browser security #23

juriejan opened this issue Mar 27, 2014 · 5 comments

Comments

@juriejan
Copy link
Contributor

I can seem to get this plugin working. My simple test and coverage setup works in a Google Chrome browser with the --allow-file-access-from-files flag set to true. When the flag is not set it returns undefined for the coverage percentage, which seems to be what's happening when I try to run the task:

Running "blanket_mocha:all" (blanket_mocha) task
Testing: tests/all.html

  ․

  1 passing (107ms)

FAIL [100% = undefined% ] : file:///home/juriejan/Projects/grunt-book/tests/src/one.js (2 / 2)

Per-File Coverage Results: (undefined% minimum)
FAIL : 1/1 files failed coverage

I've tried turning off web security at both the CLI and page levels for the PhantomJS process that get's spawned, but the issue persists.

Since there's nothing in the documentation regarding this, I assume that I'm might b missing something fairly obvious.

@geekdave
Copy link
Contributor

@juriejan: does the code in the /example directory work for you? If so, then it could just be a mis-configuration of this particular project. Could you please post your Gruntfile and test html/js?

@geekdave
Copy link
Contributor

You can also try running your code from a local web server (such as connect or http-server) and using the urls property instead of src as shown here: https://github.com/kmiyashiro/grunt-mocha#optionsurls

@juriejan
Copy link
Contributor Author

I was specifically trying to get along without running a server. I had pretty much replicated the example in my own setup, but went ahead and tried the example as is, which worked fine.

After trying a whole bunch of combinations I finally figured out that my problem was being caused by not having the threshold option set in my grunt task configuration. Am I right in thinking of this as a bug? I would think that the default value of 60 being applied should also prevent this error.

The reason I though the error was being caused by not being able to access the the source files from the test file was due to the behavior of Google Chrome, which required the --allow-file-access-from-files to be set to true.

@geekdave
Copy link
Contributor

Indeed, that does sound like a bug. Thanks for taking the time to
investigate and report. Will fix this so that the task will use a sensible
default if a threshold is not defined.

On Sat, Mar 29, 2014 at 5:42 AM, Jurie-Jan Botha
[email protected]:

I was specifically trying to get along without running a server. I had
pretty much replicated the example in my own setup, but went ahead and
tried the example as is, which worked fine.

After trying a whole bunch of combinations I finally figured out that my
problem was being caused by not having the threshold option set in my
grunt task configuration. Am I right in thinking of this as a bug? I would
think that the default value of 60 being applied should also prevent this
error.

The reason I though the error was being caused by not being able to access
the the source files from the test file was due to the behavior of Google
Chrome, which required the --allow-file-access-from-files to be set to
true.

Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-38993286
.

@geekdave
Copy link
Contributor

I've created a new issue for this which sums up the issue. Will fix it there. #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants