g00dnatur3 / jscover-sbt-plugin

A plugin for Play Framework to enable getting javascript code coverage of functional tests
2 stars 1 forks source link

Add support for all JSCover options #1

Open tntim96 opened 10 years ago

tntim96 commented 10 years ago

Could make example a bit more elaborate with --no-instrument but need support for JSCover's options.

You may be able to use ConfigurationForFS.java as done in FileMojo.java and JSCoverMojo.java in the jscover maven plugin, which then runs

        ConfigurationForFS config = new ConfigurationForFS();
        //configure the settings
        config.setSrcDir(srcDir);
...
        Main main = new Main();
        main.initialize();
        main.runFileSystem(config);
g00dnatur3 commented 10 years ago

How would you suggest I allow the user input these parameters? Thru the command-line or inside the build file... Also, in your opinion which options are the MUST support and the SHOULD support... thanks for your feedback. I'm very happy you took the time to check out the project! :)

tntim96 commented 10 years ago

Not sure yet - am looking at the documentation for plugins, plugin best practices and this list of existing plugins. It's probably worth looking at how some of those plugin work.

in your opinion which options are the MUST support and the SHOULD support

Not sure I can comment without knowing the test infrastructure defaults and how much the tests can vary, but normally you'd need at least:

The file-system options are listed here

g00dnatur3 commented 10 years ago

Wow, so if I understand you correctly, then "--local-storage" is very important. So if I have a test case that navigates to multiple pages-- ie go to page1 "do something" go to page2 "do something"-- in this situation-- I will only see coverage pertaining to the last page, not the entire set of pages that were touched UNLESS i use "--local-storage" option? is my understanding correct?

g00dnatur3 commented 10 years ago

If that is the case then I would argue that "--local-storage" should be on by default-- because its more intuitive to think that if i run a functional test case that navigates across a set of pages I would like coverage to pertain to all pages/javascript that was used during the test. Just my thoughts

tntim96 commented 10 years ago

Yes, I've made it the default in the maven plugin (see line 37 of JSCoverMojo)

g00dnatur3 commented 10 years ago

Ok, I made the --local-storage default and I added support for --no-instrument

I also updated the example to be have "more"... I will close this issue after I get your feedback.

Thanks

tntim96 commented 10 years ago

Looks OK and runs OK. Couple of questions though:

g00dnatur3 commented 9 years ago

Why do you store the JSON and original-src separately to the other jscoverage files?

I actually can't remember, what is the best approach in your opinion?

I use eclipse IDE -- i just do "play eclipse" or "sbt eclipse" to create the project files...

And then when i go into eclipse I import the directory of the project as an existing eclipse project...

tntim96 commented 9 years ago

Usually all the JSCover report files (jscoverage.html, jscoverage.js, etc...) go in the same directory with the original-src so the report can be viewed with jscoverage.html.

Re: play eclipse Is there an activator equivalent command?