grunt-protractor-coverage 'no coverage object in the browser'

筅森魡賤 提交于 2019-12-05 00:44:30

问题


I have been running into a problem with grunt protractor coverage, and it seems to be an open issue. Others had this problem here ( https://github.com/r3b/grunt-protractor-coverage/issues/10 ), and the issue was closed, but not really resolved.

I went ahead and reproduced the issue on my open source project https://github.com/peterhendrick/openSource. It's a mean.js template application and I've added grunt-protractor-coverage and it's dependencies. When I run the gruntfile, everything seems to work, protractor runs, the files are instrumented, but when the report comes out I get 100% coverage of zero files. I seperated the protractor gruntfile from the dev gruntfile and named it gruntfile-e2e.js.

You should be able to reproduce easily if you run these commands:

~$ git clone https://github.com/peterhendrick/openSource

Of course, install the package.json:

~$ cd openSource

~/openSource$ npm install

Update the selenium driver:

~/openSource$ ./node_modules/.bin/webdriver-manager update

(I start up the driver before tests, so there's no need to start a server for the webdriver)

Start the app in a server (default is port 3000). You will need a mongodb instance to be running:

~/openSource$ npm start

Open another terminal and navigate to the app folder and run the e2e gruntfile to see the issue:

~/openSource$ grunt --gruntfile gruntfile-e2e.js

You should see the following near the end:

"Running "protractor_coverage:local" (protractor_coverage) task Collector started on port 3001 Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://......

No coverage object in the browser.

.

Finished in 4.716 seconds 1 test, 1 assertion, 0 failures"

If anyone could help me get passed this issue, it would be much appreciated.

来源:https://stackoverflow.com/questions/27826822/grunt-protractor-coverage-no-coverage-object-in-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!