Coder Social home page Coder Social logo

timurstrekalov / saga Goto Github PK

View Code? Open in Web Editor NEW
87.0 87.0 25.0 1.18 MB

Better code coverage tool for JavaScript.

Home Page: http://timurstrekalov.github.com/saga/

License: Other

Groovy 0.33% Shell 0.55% Java 81.86% JavaScript 9.91% HTML 7.27% Smalltalk 0.07%

saga's People

Contributors

chuckdumont avatar just-boris avatar mprins avatar sieverssj avatar snappedtogrid avatar timurstrekalov avatar worldjoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

saga's Issues

Account for jasmine spies?

Not sure if this is a question or an enhancement request, but we noticed that there was no coverage counted (and rightly so) for code (like jquery ajax calls, modal dialog boxes, etc.) where we used spies in our jasmine specs. It seems like those lines should be counted if properly spied on similar to Java mocking frameworks like Mockito, etc. do seem to work well with Java coverage tools like Clover, Cobertura, and Emma.

Look & Feel

Dear Contributor,

Please enhance colours to sexy level and get rid of text underscoring.

Regards,
Marat Huitko

Error when instrumenting an empty script

aused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.github.timurstrekalov:saga-maven-plugin:1.0.4:coverage failed: java.util.concurrent.ExecutionException: java.util.NoSuchElementException
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.util.NoSuchElementException
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:132)
at com.github.timurstrekalov.saga.maven.SagaMojo.execute(SagaMojo.java:80)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.util.concurrent.ExecutionException: java.util.NoSuchElementException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:126)
... 22 more
Caused by: java.util.NoSuchElementException
at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1098)
at java.util.TreeMap$KeyIterator.next(TreeMap.java:1154)
at com.github.timurstrekalov.saga.core.ScriptData.getLineNumberOfFirstStatement(ScriptData.java:56)
at com.github.timurstrekalov.saga.core.CoverageGenerator.collectAndWriteRunStats(CoverageGenerator.java:205)
at com.github.timurstrekalov.saga.core.CoverageGenerator.runTest(CoverageGenerator.java:184)
at com.github.timurstrekalov.saga.core.CoverageGenerator.access$200(CoverageGenerator.java:26)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(CoverageGenerator.java:107)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(CoverageGenerator.java:101)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Possible Issue When Using Mockjax?

When I run my QUnit tests in the QUnit Test Harness in Chrome, and also in PhantomJS my unit tests that mock service calls using Mockjax work properly. However, when I look at the corresponding code coverage reports that are generated when that same test harness is run using saga, it appears as though the service calls are failing, which leads me to believe that Saga is not properly working with Mockjax.

Have you done any testing, or validation using Mockjax?

TeamCity Integration?

I have been trying to use JSCoverage in order to do code coverage for QUnit tests I've written. I mostly do .NET projects (using MVC), but realistically speaking, that shouldn't matter because we're still just talking about Javascript. I ran into the same types of problems with configuration in my CI environment. Then I discovered Saga, and like what I'm seeing so far.

Is there an easy way to take the current code base and run it on TeamCity (using Powershell or a Command Line build step)? Would it require an MSBuild step? Any help would be appreciated.

Instrumentation fails when using steal.js

I tried to help out a colleague that was using this plugin and the plugin would report no tests to run, so it exited. I looked at the SpecRunner that was generated by the jasmine-maven plugin and found that they were using steal.js to dynamically load the application javascript files and hence, they never get instrumented. Any ideas??

Failure when executing jquery-1.4.2.min.js

Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read property "1" from null (https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js#853)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:146)
at com.github.timurstrekalov.saga.cli.Main.main(Main.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.util.concurrent.ExecutionException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read property "1" from null (https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js#853)
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:139)
... 6 more
Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read property "1" from null (https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js#853)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:499)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:973)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:349)
at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:230)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:240)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:598)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:556)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1142)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1044)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3018)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2005)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:908)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:789)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:225)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:179)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:221)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:106)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:433)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:373)
at com.github.timurstrekalov.saga.core.CoverageGenerator.runTest(CoverageGenerator.java:186)
at com.github.timurstrekalov.saga.core.CoverageGenerator.access$200(CoverageGenerator.java:29)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(CoverageGenerator.java:120)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(CoverageGenerator.java:114)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot read property "1" from null (https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js#853)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3790)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3768)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3796)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3815)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3828)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectIndex(ScriptRuntime.java:1566)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1431)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:854)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3183)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:490)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:589)
... 40 more

How to use with Javascript Testing Frameworks

Hi, this library looks awesome, but I'm having some difficulty in trying to figure out how to configure / use it.

I would really like to use this with Jasmine but I'm not sure if it work with it?

Thanks!

Is there a way to use the generated ManualSpecRunner.html in the target directory?

Hi:
I have had to 'hack' together a solution to get the ManualSpecRunner.html generated by the Jasmine Maven plugin to work in Saga by using the maven resources plugin to move that file to the project base directory of my project. It seems to work, but I consider the additional step of copying files around to be a smell. Am I missing something or can you provide some documentation/examples of using Saga in concert with the Maven-Jasmine plugin? Thanks......

Remove extraneous noise from coverage report

It appears that there is some noise on the coverage report. For example:

JavaScriptStringJob
rs.cleanup();rs.activeselection=false;

and

eval code#1(eval)(0)
...............................

are included on the coverage report. Can these be suppressed?

Does it matter the order in which Spec files are run in the SpecRunner?

I have been struggling with this issue for a while on our project. I ran the Saga plugin against our .js files using a SpecRunner generated from the Maven Jasmine plugin and also ran the same SpecRunner against the same code using the old command-line JSCoverage. Just as I feared, the code instrumented and run using the command-line JSCoverage showed significantly higher test coverage than the Saga Maven plugin. What was even more strange was that some of the .js files showed identical coverage numbers where others were completely different. After trying multiple ideas out, it appears that the ordering of the javascript Spec files in the SpecRunner do matter, at least for our project. The current workaround appears to be putting an _ in front of the Spec file to assure that it gets loaded above others, but I think that this is just masking the real issue.
So the question is: Do you have any idea why our coverage numbers are different depending on the order that Spec files are loaded in the SpecRunner?

Not covered classes in report

As a user
I want to see not covered classes in report
So that I could see full coverage picture of my project

Scenario: User views report for selected area

Given user run tests
When user opens report
Then list of classes for selected repository lists in report
And classes with zero coverage are shown on the top
And total coverage is reflected accordingly

Feature request - AMD detection

I have enjoyed using your coverage plugin so far, but I've found an area where it could be improved. As I understand it, the plugin looks for .html files and instruments the tests loaded in the html file. I use Require.js throughout my application and unit tests, so I only have one SpecRunner.html, and it uses Require.js to load each of my numerous test files. The problem is that the plugin appears to count each .html file as one test, so when I run saga with TOTAL or PERTEST I get the same result. This isn't a make-it or break-it issue, but it would be nice for saga to detect AMD and recognize that each spec.js file loaded by my one .html file is a different test, and display results accordingly. Food for thought.

Running through web server?

Most of my tests doesn't work without running them through the web server, is it possible to pass the url to the server with spec runner instead of baseDir?

eval() in js code would cause exception in FileStats.getFilePath()

Cause:

eval() in javascript file would cause file paths in FileStats end in "some/path/myscript.js#342(eval)"

The error actually occur at line 139 for FileStats.java, where the logic is trying to access the file and get an absolute path from it.

Stacktrack:
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: com.github.timurstrekalov.saga.core.FileStats.filePath
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:110)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:68)
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1115)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:208)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:143)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:691)
    at org.stringtemplate.v4.Interpreter.writeIterator(Interpreter.java:721)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:696)
    at org.stringtemplate.v4.Interpreter.writeObjectWithOptions(Interpreter.java:653)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:290)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:143)
    at org.stringtemplate.v4.ST.write(ST.java:388)
    at org.stringtemplate.v4.ST.write(ST.java:421)
    at org.stringtemplate.v4.ST.write(ST.java:392)
    at com.github.timurstrekalov.saga.core.CoverageGenerator.writeRunStats(CoverageGenerator.java:321)
    at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:179)
    at com.github.timurstrekalov.saga.maven.SagaMojo.execute(SagaMojo.java:85)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

console is not defined

I get this error.
[INFO] --- saga-maven-plugin:1.1.0:coverage (default) @ jpa ---
10:08:31.046 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - 1 tests found
10:08:31.049 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Using up to 1 threads
10:08:31.049 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Output strategy set to TOTAL
10:08:31.050 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Using the following no-instrument patterns:
\b.+/test/.+.js\b
.+_from\d+\d+to\d+\d+$
\b.+/assets/.+.js\b
10:08:31.055 [pool-2-thread-1] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Running /C:/Work/DNA/Apps/jpa-mvc-ajax/src/main/webapp/re
sources/test/jasmine/index.html
10:08:31.737 [pool-2-thread-1] ERROR com.github.timurstrekalov.saga.core.QuietJavaScriptErrorListener - Script exception on page file:/C:/Work/DNA/App
s/jpa-mvc-ajax/src/main/webapp/resources/test/jasmine/index.html, message: ReferenceError: "console" is not defined. (script in file:/C:/Work/DNA/Apps
/jpa-mvc-ajax/src/main/webapp/resources/test/jasmine/index.html from (9, 36) to (17, 14)#10)
10:08:33.333 [pool-2-thread-1] ERROR com.github.timurstrekalov.saga.core.QuietJavaScriptErrorListener - Script exception on page file:/C:/Work/DNA/App
s/jpa-mvc-ajax/src/main/webapp/resources/test/jasmine/index.html, message: ReferenceError: "console" is not defined. (file:/C:/Work/DNA/Apps/jpa-mvc-a
jax/src/main/webapp/resources/app/util/logging.js#36)
10:08:33.759 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Test run finished
10:08:33.769 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Writing raw coverage report: C:\Work\DNA\Apps\jpa-mvc-ajax\target\ja
smine\total-coverage.dat
10:08:33.848 [main] INFO com.github.timurstrekalov.saga.core.CoverageGenerator - Writing html coverage report: C:\Work\DNA\Apps\jpa-mvc-ajax\target\j
asmine\total-report.html

But in my SpecRunner.html I have:

<title>jpa-mvc-ajax Jasmine Unit Tests</title>
<link rel="stylesheet" type="text/css" href="lib/jasmine/jasmine-1.2.0/jasmine.css">

<!-- list jasmine and jasmine plugins here... -->
<script type="text/javascript">
  if (!console) {
    console = {
      log: function () {},
      warn: function () {},
      error: function () {}
    }
  }
</script>
<script type="text/javascript" src="lib/jasmine/jasmine-1.2.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine/jasmine-yeti-adaptor.js"></script>
<script type="text/javascript" src="lib/jasmine/jasmine-1.2.0/jasmine-html.js"></script>
<script type="text/javascript" src="lib/sinon/sinon-1.3.1.js"></script>
<script type="text/javascript" src="lib/jasmine/jasmine-jquery.js"></script>
<script type="text/javascript" src="lib/jasmine/jasmine-ajax.js"></script>
<script type="text/javascript" src="../../assets/js/lib/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../assets/js/lib/jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src="../../assets/js/lib/underscore/underscore.js"></script>
<script type="text/javascript" src="../../assets/js/lib/backbone/backbone.js"></script>
<script type="text/javascript" src="../../assets/js/lib/backbone/backbone.paginator.js"></script>
<script type="text/javascript" src="../../assets/js/lib/handlebars/handlebars.js"></script>

<!-- boot the requirejs module loader -->
<script type="text/javascript" src="lib/require/require.js" data-main="initTests"></script>

NullPointerException with PER_TEST strategy and no actual tests run

java.lang.NullPointerException: null
at com.github.timurstrekalov.saga.core.CoverageGenerator.writeRunStats(CoverageGenerator.java:283) ~[saga-core-1.0.11-SNAPSHOT.jar:na]
at com.github.timurstrekalov.saga.core.CoverageGenerator.access$300(CoverageGenerator.java:33) ~[saga-core-1.0.11-SNAPSHOT.jar:na]
at com.github.timurstrekalov.saga.core.CoverageGenerator$1.call(CoverageGenerator.java:133) ~[saga-core-1.0.11-SNAPSHOT.jar:na]
at com.github.timurstrekalov.saga.core.CoverageGenerator$1.call(CoverageGenerator.java:124) ~[saga-core-1.0.11-SNAPSHOT.jar:na]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) ~[na:1.6.0_31]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) ~[na:1.6.0_31]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) ~[na:1.6.0_31]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) ~[na:1.6.0_31]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) ~[na:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) ~[na:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) ~[na:1.6.0_31]
at java.lang.Thread.run(Thread.java:680) ~[na:1.6.0_31]

Extra Documentation

Hi:
I am trying to use your plugin with a little frustration. I want to exclude a certain file from instrumentation but Saga seems to just ignore what I declare in the configuration. Can you please assist?

<noInstrumentPatterns>
<noInstrumentPattern>http(s)?.+</noInstrumentPattern>
<noInstrumentPattern>require.js</noInstrumentPattern>
</noInstrumentPatterns>

I have a file in my test runner file like this:
<script type="text/javascript" src="require.js"></script>
I assume the configuration declaration was correct, but it seems not to be so.

Maven plugin fails with Maven 2 (no type coercion there)

Failed to configure plugin parameters for: com.github.timurstrekalov:saga-maven-plugin:1.0.5

    (found static expression: 'BOTH' which may act as a default value).


Cause: Cannot assign configuration entry 'outputStrategy' to 'class com.github.timurstrekalov.saga.core.OutputStrategy' from 'BOTH', which is of type class java.lang.String

Originally reported by Jeroen Dijkhuizen

Syntax "{if(something);}" not compatible

The following rather catchy namespace instantiation idiom:

try{
    if (mynamespace);
} catch(ex) {
    mynamespace = function(){};
}

It's causing the plugin to fail with a null-pointer exception like so:

Error running test h:\Downloads\saga-maven-plugin-sample\tests\ClassTest.html: java.lang.NullPointerException

This syntax also doesn't seem to work:

{
    if(false);
}

The above is valid syntax, but it's not being understood by the plugin.

To reproduce the issue, you could just add the one of the code sections above to the Class.js from your example app below the 'use strict' directive and you'll see the problem.

I'm using version 1.0.9 of the plugin.

Keep up the good work, your plugin is looking really promising.

Run all tests through testRunner.html

Is it possible to run test not just like:
testSomething.html
but something like:
testRunner.html?testPage=testSomething.html&autoRun=true

Or, is there any another way to run test through testRunner.html?

Brief of uncovered lines

In opened section of source code missed brief description.

For example,
"Uncovered lines: 1, 3-8, 55"

With possibility to click and go this line.

NPE when baseDir doesn't exist

[ERROR] Failed to execute goal com.github.timurstrekalov:saga-maven-plugin:1.0.0:coverage (generate-coverage-report) on project [...]: Execution generate-coverage-report of goal com.github.timurstrekalov:saga-maven-plugin:1.0.0:coverage failed: basedir [...] does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.timurstrekalov:saga-maven-plugin:1.0.0:coverage (generate-coverage-report) on project [...]: Execution generate-coverage-report of goal com.github.timurstrekalov:saga-maven-plugin:1.0.0:coverage failed: basedir [...] does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-coverage-report of goal com.github.timurstrekalov:saga-maven-plugin:1.0.0:coverage failed: basedir [...] does not exist
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: basedir [...] does not exist
at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:293)
at org.codehaus.plexus.util.FileUtils.getFileAndDirectoryNames(FileUtils.java:1837)
at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1765)
at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1747)
at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1721)
at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1704)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGenerator.java:86)
at com.github.timurstrekalov.saga.maven.SagaMojo.execute(SagaMojo.java:79)

Exception When Running Command Line Version

I'm attempting to run the command line version of this, and run a TestHarness file that is made for QUnit, and I receive the exception dump below. The html file runs fine in Google Chrome.

Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.Exec
utionException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot
read property "1" from null (http://code.jquery.com/jquery-1.4.2.min.js#853)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGen
erator.java:132)
at com.github.timurstrekalov.saga.cli.Main.main(Main.java:91)
Caused by: java.util.concurrent.ExecutionException: com.gargoylesoftware.htmluni
t.ScriptException: TypeError: Cannot read property "1" from null (http://code.jq
uery.com/jquery-1.4.2.min.js#853)
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.github.timurstrekalov.saga.core.CoverageGenerator.run(CoverageGen
erator.java:126)
... 1 more
Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read
property "1" from null (http://code.jquery.com/jquery-1.4.2.min.js#853)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitCon
textAction.run(JavaScriptEngine.java:595)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:
537)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(Contex
tFactory.java:538)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(Jav
aScriptEngine.java:499)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFil
e(HtmlPage.java:973)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(H
tmlScript.java:349)
at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.ja
va:230)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPag
e(HtmlScript.java:240)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endE
lement(HTMLParser.java:598)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source
)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endE
lement(HTMLParser.java:556)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.jav
a:1142)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:10
44)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.jav
a:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder
.java:329)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScan
ner.java:3018)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2
005)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:908)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499
)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452
)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.pars
e(HTMLParser.java:789)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:2
25)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.ja
va:179)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(Defau
ltPageCreator.java:221)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPa
geCreator.java:106)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient
.java:433)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:373)
at com.github.timurstrekalov.saga.core.CoverageGenerator.runTest(Coverag
eGenerator.java:173)
at com.github.timurstrekalov.saga.core.CoverageGenerator.access$200(Cove
rageGenerator.java:26)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(Coverage
Generator.java:107)
at com.github.timurstrekalov.saga.core.CoverageGenerator$3.call(Coverage
Generator.java:101)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.