searls / jasmine-maven-plugin

Maven plugin to execute Jasmine Specs. Creates your HTML runners for you, runs headlessly, outputs JUnit XML
http://searls.github.io/jasmine-maven-plugin
Other
290 stars 163 forks source link

Javascript coudnt find file but test was green? #152

Closed tjerkw closed 11 years ago

tjerkw commented 11 years ago

I got this huge exception when running the test. Basically i'm using requirejs and it tried to locate a file which was not there.

Feb 28, 2013 1:44:47 PM com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.WrappedException]
com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    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.callFunction(JavaScriptEngine.java:545)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:520)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:896)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:84)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:313)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor.run(JavaScriptExecutor.java:148)
    at java.lang.Thread.run(Thread.java:662)
Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)

However the test was green? I expect the test to fail right?

======= EXCEPTION END ========
[INFO] 
-------------------------------------------------------
 J A S M I N E   S P E C S
-------------------------------------------------------
[INFO] 

Results: 0 specs, 0 failures
klieber commented 11 years ago

@tjerkw what version of the plugin are you using? Also, can you provide more of the output before the exception occured?

tjerkw commented 11 years ago

When i run it manually in my chrome browser with "mvn jasmine:bdd" i get thefollowing in the console:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8234/app/main.js
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.js:1765
GET http://localhost:8234/app/main.js 404 (Not Found) require.js:1843
scripterror mainSpec.js:2
Uncaught Error: Script error
http://requirejs.org/docs/errors.html#scripterror require.js:159

When i run "mvn jasmine test" i get the following complete output:

Maybe require.js overrides the window.onerror function?

 mvn jasmine:test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Frontend Skeleton 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jasmine-maven-plugin:1.2.0.0:test (default-cli) @ maven-skeleton-frontend >>>
[INFO] 
[INFO] --- jasmine-maven-plugin:1.2.0.0:resources (default-resources) @ maven-skeleton-frontend ---
[INFO] Processing JavaScript Sources
[INFO] 
[INFO] --- jasmine-maven-plugin:1.2.0.0:generateManualRunner (default-generateManualRunner) @ maven-skeleton-frontend ---
[INFO] Generating runner 'ManualSpecRunner.html' in the Jasmine plugin's target directory to open in a browser to facilitate faster feedback.
[INFO] SpecRunnerTemplate DEFAULT
[INFO] Skipping spec runner generation, because an identical spec runner already exists.
[INFO] 
[INFO] --- jasmine-maven-plugin:1.2.0.0:testResources (default-testResources) @ maven-skeleton-frontend ---
[INFO] Processing JavaScript Specs
[INFO] 
[INFO] <<< jasmine-maven-plugin:1.2.0.0:test (default-cli) @ maven-skeleton-frontend <<<
[INFO] 
[INFO] --- jasmine-maven-plugin:1.2.0.0:test (default-cli) @ maven-skeleton-frontend ---
[INFO] Executing Jasmine Specs
Feb 28, 2013 2:23:46 PM com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.WrappedException]
com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    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.callFunction(JavaScriptEngine.java:545)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:520)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:896)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:84)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:313)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor.run(JavaScriptExecutor.java:148)
    at java.lang.Thread.run(Thread.java:662)
Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1802)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:647)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$400(JavaScriptEngine.java:79)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:590)
    ... 10 more
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:154)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentAsStream(WebResponse.java:217)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharsetOrNull(WebResponse.java:156)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharset(WebResponse.java:172)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1039)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:950)
    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.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:642)
    ... 12 more
Caused by: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.gargoylesoftware.htmlunit.DownloadedContent$OnFile.getInputStream(DownloadedContent.java:63)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:151)
    ... 20 more
WrappedException: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1802)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:647)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$400(JavaScriptEngine.java:79)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:590)
    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.callFunction(JavaScriptEngine.java:545)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:520)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:896)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:84)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:313)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor.run(JavaScriptExecutor.java:148)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:154)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentAsStream(WebResponse.java:217)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharsetOrNull(WebResponse.java:156)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharset(WebResponse.java:172)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1039)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:950)
    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.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:642)
    ... 12 more
Caused by: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.gargoylesoftware.htmlunit.DownloadedContent$OnFile.getInputStream(DownloadedContent.java:63)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:151)
    ... 20 more
Inside wrapped exception:
java.lang.RuntimeException: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:154)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentAsStream(WebResponse.java:217)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharsetOrNull(WebResponse.java:156)
    at com.gargoylesoftware.htmlunit.WebResponse.getContentCharset(WebResponse.java:172)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1039)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:950)
    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.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:642)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$400(JavaScriptEngine.java:79)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:590)
    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.callFunction(JavaScriptEngine.java:545)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:520)
    at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:896)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:84)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:313)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor.run(JavaScriptExecutor.java:148)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.FileNotFoundException: /home/twolterink/work/gitlab/maven-skeleton-frontend/target/jasmine/app/main.js (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.gargoylesoftware.htmlunit.DownloadedContent$OnFile.getInputStream(DownloadedContent.java:63)
    at com.gargoylesoftware.htmlunit.WebResponseData.getInputStream(WebResponseData.java:151)
    ... 20 more
== CALLING JAVASCRIPT ==

  function () {
      intakeDefines();
      requireMod = getModule(makeModuleMap(null, relMap));
      requireMod.skipMap = options.skipMap;
      requireMod.init(deps, callback, errback, {enabled:true});
      checkLoaded();
  }

======= EXCEPTION END ========
[INFO] 
-------------------------------------------------------
 J A S M I N E   S P E C S
-------------------------------------------------------
[INFO] 

Results: 0 specs, 0 failures

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.746s
[INFO] Finished at: Thu Feb 28 14:23:46 CET 2013
[INFO] Final Memory: 11M/148M
[INFO] ------------------------------------------------------------------------
klieber commented 11 years ago

@tjerkw I'm having trouble recreating this, could you provide a simple example project? Also, have you tried using the latest version of the plugin? Latest version is currently 1.3.1.1.

tjerkw commented 11 years ago

I do not have the sources to the project anymore. I think it has something todo with bootstrapping the test using requirejs. Since i loaded a lot of javascript into the page, it might be caused by that. I think closing this ticket is OK. Since i dont know howto reproduce this.