Coder Social home page Coder Social logo

searls / jasmine-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
290.0 290.0 163.0 8 MB

Maven plugin to execute Jasmine Specs. Creates your HTML runners for you, runs headlessly, outputs JUnit XML

Home Page: http://searls.github.io/jasmine-maven-plugin

License: Other

Ruby 1.02% Java 57.36% JavaScript 16.41% HTML 21.14% Gherkin 4.05% Shell 0.02%

jasmine-maven-plugin's Introduction

jasmine-maven-plugin

Build Status Coverage Status Maven Central

For information on how to use the jasmine-maven-plugin, check out its documentation page.

Current Version Info

You can find the latest release along with release notes here.

If you want to point at snapshot releases of the plugin (note that I don't deploy them often), they're hosted on the Sonatype OSS snapshot repository.

Maintainers

Issues

If you have any problems, please check the project issues.

Contributions

Pull requests are, of course, very welcome! Please read our contributing to the project guide first. Then head over to the open issues to see what we need help with. Make sure you let us know if you intend to work on something. Also, check out the milestones to see what is planned for future releases.

Acknowledgments

  • Thanks to Pivotal Labs for authoring and publishing Jasmine
  • Thanks to christian.nelson and sivoh1, owners of the javascript-test-maven-plugin project, which provided a similar implementation from which to glean several valuable lessons.
  • Thanks to all who have contributed with pull requests, issues, suggestions.

jasmine-maven-plugin's People

Contributors

aphethean1 avatar bhamail avatar davidpadbury avatar ddumont avatar dependabot[bot] avatar dfabulich avatar dfreeman avatar ebaxt avatar fduckart avatar gejgalis avatar guilhermesilveira avatar hikaruworld avatar johnomalley avatar klieber avatar kreyssel avatar luizfar avatar maroschutte avatar pzygielo avatar rvalle avatar samjonester avatar searls avatar skrall avatar toddq avatar tongant avatar voelzmo 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

jasmine-maven-plugin's Issues

Allow Browser target to be configurable

Currently the headless execution of the plugin targets FF 3.0, which can be surprising for people. So this:

WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);

Should be configurable, and the default should be better thought-out (I'd prefer to target webkit).

jasmine logging versus maven logging

This backtrace subset suggests that it would be a good idea for the jasmine plugin to make from commons logging to the maven log instead of allowing commons logging to get loose and go hunting for other options.

   at org.apache.log4j.Logger.getLogger(Logger.java:105)
at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:289)
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:109)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1116)
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:914)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at com.gargoylesoftware.htmlunit.WebClient.<clinit>(WebClient.java:116)
at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:31)

jasmine:bdd uses jetty, but jasmine:test uses file system

Searls,

BTW, I've just finished using jasmine:bdd for a couple days with a Ext JS 4 application and love it. It works great. I do have an issue with jasmine:test. It is probably specific to Ext JS 4 and likely won't affect others.

It appears that during jasmine:bdd, Jetty delivers the files over http://. But during jasmine:test, the files are delivered as file:/

mvn jasmine:bdd
<script type="text/javascript" src="../../src/main/webapp/app.js"></script>

mvn jasmine:test
<script type="text/javascript" src="file:/Users/admin/workspace/git/ibis/ucas-webapp/target/jasmine/src/app.js"></script>

This gets in the way of the ext dynamic loading...I guess because of Same Origin Policy with the browsers...they don't like file:/ protocol. I understand that it's not your goal to make this work for Ext JS 4. But I just wanted to make sure that you are indeed writing the Spec scripts with the file:/ protocol and this is not a bug.

Cheers,
Dehru

Jasmine plugin can't find specs

Hi,

I must be missing something, but I feel I have everything correctly configured. Here's the output I have from Maven debug, but the plugin can't seem to find my specs to run; it always says "Results: 0 specs, 0 failures" . Any suggestions?

[DEBUG] Configuring mojo 'com.github.searls:jasmine-maven-plugin:1.0.2-beta-5:bdd' -->
[DEBUG]   (f) browserVersion = FIREFOX_3
[DEBUG]   (f) debug = false
[DEBUG]   (f) format = documentation
[DEBUG]   (f) haltOnFailure = true
[DEBUG]   (f) jasmineTargetDir = C:\dev\QES\stargate-ui\UiView\stargate-ui\target\jasmine
[DEBUG]   (f) jsSrcDir = C:\dev\QES\stargate-ui\UiView\stargate-ui\src\main\webapp
[DEBUG]   (f) jsTestSrcDir = C:\dev\QES\stargate-ui\UiView\stargate-ui\src\main\webapp\spec
[DEBUG]   (f) junitXmlReportFileName = TEST-jasmine.xml
[DEBUG]   (f) manualSpecRunnerHtmlFileName = ManualSpecRunner.html
[DEBUG]   (f) mavenProject = MavenProject: com.qualcomm.qes.hos.ui.stargate:stargate-ui:1.0.0-SNAPSHOT @ C:\dev\QES\stargate-ui\UiView\stargate-ui\pom.xml
[DEBUG]   (f) packageDir = C:\dev\QES\stargate-ui\UiView\stargate-ui\target\stargate-ui-1.0.0-SNAPSHOT
[DEBUG]   (f) packageJavaScriptPath = js
[DEBUG]   (f) serverPort = 8234
[DEBUG]   (f) sourceIncludes = [C:\dev\QES\stargate-ui\UiView\stargate-ui/src/main/webapp/**/*.js]
[DEBUG]   (f) specDirectoryName = spec
[DEBUG]   (f) specIncludes = [C:\dev\QES\stargate-ui\UiView\stargate-ui/src/main/webapp/spec/**/*.js]
[DEBUG]   (f) specRunnerHtmlFileName = SpecRunner.html
[DEBUG]   (f) srcDirectoryName = src
[DEBUG]   (f) timeout = 300
[DEBUG] -- end configuration --

The spec I'm trying to run is as follows under the spec directory identified above:

describe("Jasmine Check", function() {
    it("Check Ext", function() {
       expect(Ext.isBoolean(true)).toBeTruthy(); 
    });
});

Finally, here is how it's configured in the POM:

        <plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>1.0.2-beta-5</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <jsTestSrcDir>${basedir}/src/main/webapp/spec</jsTestSrcDir>
                <jsSrcDir>${basedir}/src/main/webapp</jsSrcDir>
                <sourceIncludes>
                    <include>${basedir}/src/main/webapp/**/*.js</include>
                </sourceIncludes>
                <specIncludes>
                    <include>${basedir}/src/main/webapp/spec/**/*.js</include>
                </specIncludes>                    
            </configuration>
        </plugin>

TIA,
Lou

jsTestSrcDir path is trimmed if it starts with a "t" character

I'm configuring jasmine-maven-plugin so that it picks the specs from test/specs. To do so I use jsTestSrcDir to specify the specs directory as shown below:

            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <jsSrcDir>${project.basedir}/js</jsSrcDir>
                <preloadSources>
                    <source>${project.basedir}/js/libs/jquery.1.6.4.js</source>
                </preloadSources>
                <jsTestSrcDir>${project.basedir}/test/specs</jsTestSrcDir>
            </configuration>

When I load http://localhost:8234 any spec is run (not detected). Looking at the generated html in localhost I see things like:

<script type="text/javascript" src="../../est/specs/util.spec.js"></script>

Note that the initial "t" from "test/specs" has been removed. I've done several tests and as soon as jsTestSrcDir path starts with a "t" it's removed from the path.

Use EvnJs instead of HtmlUnit

Hi, this is not really an issue, bu i didnt' find a better place to ask question related to project.

Why HtmlUnit is used? Did you considered using EnvJs?

Thanks!

Leave jasmine.js as a separate file

Hi,
looking at the generated SpecRunner.html, seems that you include jasmine framework as inline javascript.

It should be more clear and readable if jasmine.js will be copied as an independent file rather than embedded in html.

How to load sources outside of jsSrcDir.

My project relies on scripts from an external maven project. I pulled these into my jasmine test directory, but I can't get them to load before my source directory. I don't want to put them in my source directory because I don't want them deployed in the WAR.

Using a structure similar to this:

<jsSrcDir>${project.basedir}/src/main/webapp/api/script</jsSrcDir> <jsTestSrcDir>${project.basedir}/src/test/javascript/jasmine</jsTestSrcDir>

I've tried this:
<sourceIncludes> <include>${project.basedir}/src/test/javascript/external</include> <include>**/*.js</include> </sourceIncludes>

and this. I can navigate to jsSrcDir in a command window and paste "cd ../../../../test/javascript/external" and successfully switch to the external directory.
<sourceIncludes> <include>../../../../test/javascript/external</include> <include>**/*.js</include> </sourceIncludes>

...but it does not find the external directory either.

I tried this:
<jsSrcDir>${project.basedir}/src/main/webapp/api/script</jsSrcDir> <jsTestSrcDir>${project.basedir}/src/test/javascript</jsTestSrcDir> <specIncludes> <include>external/*.js</include> <include>jasmine/*.js</include> </specIncludes>

That successfully finds the external scripts, but they are still loaded after the source directory.

Any ideas?

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils

While I can get jasmine-maven-plugin to work just fine locally, I'm getting the following exception when running tests on my Jenkins server with the included POM.

Does jasmine require the StringUtils dependency to required in order to work in certain environments? I'm thinking this could just be a stupid configuration problem on my end (but it's really strange that it fails on Jenkins and works just fine locally). Thanks for you help!

        <profile>
            <id>jasmine-tests</id>
            <dependencies>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.searls</groupId>
                        <artifactId>jasmine-maven-plugin</artifactId>
                        <version>1.0.2-beta-5</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <jsSrcDir>${project.basedir}/src/main/webapp/scripts</jsSrcDir>
                            <sourceIncludes>
                                <include>jquery/jquery-1.5.2.min.js</include>
                                <include>jquery/jquery-ui-1.8.12.custom.min.js</include>
                                <include>future/libs.js</include>
                                <include>future/studio-libs.js</include>
                                <include>future/metrics.js</include>
                            </sourceIncludes>
                            <jsTestSrcDir>${project.basedir}/src/test/javascript/spec</jsTestSrcDir>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
[INFO] Trace
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at com.github.searls.jasmine.io.scripts.RelativizesASetOfScripts.normalize(RelativizesASetOfScripts.java:31)
    at com.github.searls.jasmine.io.scripts.RelativizesASetOfScripts.relativize(RelativizesASetOfScripts.java:19)
    at com.github.searls.jasmine.CreatesManualRunner.scriptsForRunner(CreatesManualRunner.java:43)
    at com.github.searls.jasmine.CreatesManualRunner.create(CreatesManualRunner.java:34)
    at com.github.searls.jasmine.GenerateManualRunnerMojo.run(GenerateManualRunnerMojo.java:15)
    at com.github.searls.jasmine.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:193)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:643)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Source order not preserved:

                        <specIncludes>
                            <include>lib/jasmine-jquery.js</include>
                            <include>**/*.js</include>
                        </specIncludes>

If I run "mvn site", my test suite works correctly with the source in the coerced order as above.

If I run " mvn jasmine:resources jasmine:testResources jasmine:test" the specRunner.html seems to put the scripts in alpha order, which fails my tests, eg:

<script type="text/javascript" src="file:/c:/code/dashboard-web/target/jasmine/spec/keyboardSpec.js"></script>
<script type="text/javascript" src="file:/c:/code/dashboard-web/target/jasmine/spec/lib/jasmine-jquery.js"></script>
<script type="text/javascript" src="file:/c:/code/dashboard-web/target/jasmine/spec/mainSpec.js"></script>

Am I not using the correct mvn commands, or is this a bug ?

Also, why do I need to explicitly ask for all thejasmine:XXX task - I initially expected "mvn jasmine:test" to automatically run the prerequisites needed, but it didnt run the tests as they werent processes/copied..

Using console.log causes maven build to fail

Take this javascript file

console.log('Welcome aboard!');

var HelloWorld = function() {
    this.greeting = function() {
        return "Hello, World";
    }
}

while doing a new maven build the test phase fails because console is not defined.

[INFO] Executing Jasmine Specs
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.289s
[INFO] Finished at: Mon Jan 23 11:36:54 CET 2012
[INFO] Final Memory: 26M/302M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.searls:jasmine-maven-plugin:1.1.0:test (default) on project kapsalonreflection-app: The jasmine-maven-plugin encountered an exception:
[ERROR] java.lang.RuntimeException: org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "console" is not defined.

I wonder how other people solved this?

jasmine.log output disappears

I can't see the results of jasmine.log at all. Not in mvn -X, not in log4j, not in any of the outputs of target/jasmine.

Allow for AMD modules

I would like to have support for AMD modules in my jasmine tests.

This requires a little different setup of the specs and runner code.

I have a suggested solution for running jasmine:bdd, but I have yet to dig into how to run jasmine:test

Background

AMD modules are a common way to write maintainable JavaScript applications. Common implementations are require.js, almond, & CommonJS.

For example, a source file could look like this:

// my_module.js
define(['lib/dependency1', './dependency2'], function(dep1, dep2) {
   ...
   return MyModule;
});

And a spec would be written like this:

// my_module_spec.js
require(['my_module'], function(MyModule) {
    describe('my module's tests', function () {
      // regular old jasmine tests using MyModule
    });
});

That means the generated html driver needs to look something like this:

<script src="main/lib/require.js"/></script><!-- This is a preloadSource -->
<script>
   require([ // this is an array of all the _test_ sources
        'test/my_module_test.js',
        'test/my_other_test.js'
   ], function () {
        // regular jasmine runner code
   });
</script>

The problem and possible solution

The example runner only provides a $sources$ variable that prints out both the app sources and the test sources as html script tags. What I need is this to be a javascript array of only the test sources.

As I said at the beginning, I don't know what it would take to make this work with jasmine:test.

Cannot call method "toEqual"

When i was running the maven 'test' goal, i am getting

  • TypeError: Cannot call method "toEqual" of undefined in file

This is whats there in the spec.

describe("TEST SPEC", function() {

it('should increment a variable', function () {
var foo = 0; // set up the world
foo++; // call your application code
expect(foo).toEqual(1); // passes because foo == 1
});

});

Am i doing something wrong? I see the jasmine code in the specrunner.html (aswell manualspecrunner.html).

Any help will be appreciated.

HTMLUnit throws an error when loading underscoreJS

When trying to load underscoreJS, I get the following issue:

[INFO] The jasmine-maven-plugin encountered an exception:
java.lang.RuntimeException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "replace" of null (file:/
c:/Documents%20and%20Settings/onguyen/workspace/backbonejs/target/jasmine/src/vendor/underscore-min.js#25)
at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:47)
at com.github.searls.jasmine.TestMojo.executeSpecs(TestMojo.java:56)
at com.github.searls.jasmine.TestMojo.run(TestMojo.java:33)
at com.github.searls.jasmine.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:193)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)

no way to disable/enable warnings coming from HtmlUnit

any possibilities to turn off/on the chatty htmlUnit error messages in this plugin?

16.09.2011 11:49:31 com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNUNG: CSS error: null [8:438] Fehler in Ausdruck. Ungรผltiger Token "=". Erwartet wurde einer von: , , "/", , "-", , <
STRING>, ")", , "inherit", , , <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, , <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, , , , , .
16.09.2011 11:49:31 com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNUNG: CSS error: null [8:443] Fehler in Style-Regel. Ungรผltiger Token "opacity". Erwartet wurde einer von: "}", ";".
http://htmlunit.sourceforge.net/faq.html#AJAXDoesNotWork

reference:http://htmlunit.sourceforge.net/faq.html#AJAXDoesNotWork

Include option for poor man's CI

Add a configuration option to enable auto-refresh in the manual test runner after X seconds, as some folks have grown accustomed to spec-driving with this

Goal preparePackage ignores ${project.build.outputDirectory}

The default output directory of a build is normally set in ${project.build.outputDirectory} as:

... target/scripts ...

The preparePackage goal ignores this setting and forces the target/${project.build.finalName} folder, even if an absolute path is provided in the packageJavaScriptPath configuration variable.

This probably means that the folder paths are generated with string catenation rather than using an actual java.util.File object.

The solution is to either honor the builds outputDirectory, or allow absolute file paths for the configuration variables.

multiple directories for src/spec

I want to generate some of the javascript for the specs to inject a port number into it. I'd rather keep the generated stuff in 'target', but then I'd need to be able to add more directories to the list.

Allow loading of remote scripts

Some users may load common libraries like jquery remotely and don't re-bundle the library at all in their maven artifact (e.g. google cdn: http://code.google.com/apis/libraries/devguide.html#jquery ). Those individuals don't have a way yet to use jasmine-maven-plugin in a DRY way, so we should have a configuration for remote sources. (perhaps preloadSources could take a file or a URL and autodetect which is which)

Path handling incorrect on Windows: fails if srcDir and specDir are not null

One Windows, the File.separator is ''. FileUtils.catPath and other FileUtils methods used throughout jasmine-maven-plugin expect paths to use '/' as the path separator. Also, the generated <script> tags will be incorrect, because file paths are used as is and do not result in correct URLs to load sources and specs.
I'd suggest to refrain from using strings to represent paths and instead use the JDK's File and URL classes to create paths and convert from paths to URLs in a portable way.

Tests seem to run before sourceIncludes are loaded

I'm trying to do the following:

        <plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>1.0.2-beta-5</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sourceIncludes>
                    <include>controllers/search.js</include>
                </sourceIncludes>
                <jsSrcDir>${project.basedir}/src/main/webapp/assets/js/</jsSrcDir>
            </configuration>
        </plugin>

Where I have the following spec:

describe('Controllers Spec', function () {
describe('Search Controller', function () {
it('should get location display', function () {
var controller = new App.Controlllers.SearchController();
expect(controller).toBeDefined();
});
});
});

However, it seems that the test is executing before search.js can be loaded. I tried moving this into preloadSources and had some success there, however, as soon as I had more than 3 dependencies in preloadSources, it seemed to have the same problem that I'm seeing here where some code is evaluated/executed before dependencies are loaded.

improve error printing

It was recently pointed out that MojoExecutionException does not print the full stack trace of the provided cause message. Each of the mojos currently instantiating a MojoExecutionException would be better served by a new class that could instantiate them while also printing the stack trace to a message string so that the full stack can be diagnosed by the tester. (This will be helpful because HtmlUnit will often hide the worthwhile bits of an exception four or five causes deep in a script exception)

Different behavior between jasmine:bdd and jasmine:test

I'm having in issue where jasmine:bdd works fine, but jasmine:test fails

The error message is

[ERROR] Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
[ERROR] com.gargoylesoftware.htmlunit.ScriptException: Error: Parse error on line 34: Unexpected 'TERMINATOR' (injected script#8)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601

)

This looks to be a CoffeeScript related error, but the config is defined exclusively on .js files

  <sourceIncludes>
            <include>jquery-1.7.1.js</include>
            <include>jquery-ui-1.8.16.js</include>
            <include>underscore.js</include>
            ...
      </sourceIncludes>
      <specIncludes>
            <include>**/*.js</include>
       </specIncludes>

Additional info - If I delete all of the CoffeeScript files, after the other part of the build has compiled them to .js files, then jasmine:test works w/o error.

Package copies everything when it only needs the js files

We're using JavaScript in multiple places in our project and are successfully testing it all using jasmine-maven. However the team are a little annoyed that the package phase of the project takes quite so long due to copying the entire contents of the ${src} directory to target/jasmine.

Would it be possible to filter this to only js files?

Error during generation of spec runner HTML

When I'm try to run any goal involving the spec runner HTML I got this error

Caused by: java.lang.NoClassDefFoundError: org/antlr/stringtemplate/StringTemplate
at com.github.searls.jasmine.runner.SpecRunnerHtmlGenerator.generate(SpecRunnerHtmlGenerator.java:48)
at com.github.searls.jasmine.GenerateManualRunnerMojo.writeSpecRunnerToSourceSpecDirectory(GenerateManualRunnerMojo.java:36)
at com.github.searls.jasmine.GenerateManualRunnerMojo.run(GenerateManualRunnerMojo.java:27)
at com.github.searls.jasmine.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:190)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.antlr.stringtemplate.StringTemplate
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 25 more

Caused by: java.lang.ClassNotFoundException: org.antlr.stringtemplate.StringTemplate
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 25 more

"com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter error" when running jasmine:test

-- UPDATE --
I upgraded my plugin to 1.1.0 and the problem went away.

I have a vendor dependency in my code under tests, namely 'jade'. To have jade available during the tests I include it in my pom:

<preloadSources>
    <include>javascripts/libs/jade.js</include>
</preloadSources>

Just including this dependency causes my otherwise passing tests to fail with:

[INFO] Executing Jasmine Specs
Jan 25, 2012 10:31:59 AM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter error
SEVERE: error: message=[invalid property id] sourceName=[file:/Users/eprystupa/dev/gs-marquee-poc/node-web/target/jasmine/src/javascripts/libs/jade.js] line=[1255] lineSource=[  case: function() {] lineOffset=[7]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.969s
[INFO] Finished at: Wed Jan 25 10:31:59 EST 2012
[INFO] Final Memory: 14M/81M
[INFO] ------------------------------------------------------------------------

So, it looks like jasmine forces lint validation on the vendor js file which I have no control over. Is there a way to turn this validation off?

Thanks!

Submit patch to Jenkins to include plugin in SurefireArchiver

Asking on IRC, Kohsuke alerted me to the fact that JUnit XML reports can only be specified by the user on freestyle projects. To get a maven2 project to see Jasmine's XML reports, SurefireArchiver would need to be updated to include the jasmine-maven-plugin's GAV. Once the patch is accepted, new versions of Jenkins would automatically pick up jasmine-maven-plugin's JUnit XML reports in their builds.

Not sure how to best do that yet. But there it is.

haltOnFailure isn't strong enough

Nov 2, 2011 10:28:47 AM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter error
SEVERE: error: message=[missing } after property list] sourceName=[file:/Users/benson/x/oap/it/jdd-rest/target/jasmine/spec/restTests.js] line=[21] lineSource=[ url: "http://localhost:" + jddServicePort + "/query/tasks";] lineOffset=[67]

leads to a failure. This is a problem when trying to use this in an integration-test and you want to also run post-integration-test;

HTML fixtures not copied

Hi,

I have some HTML-files (fixtures) in my spec directory, but these are not copied to my target folder even if I specify something like:

<specIncludes>
<include>**/.</include>
</specIncludes>

Only the JS-files in the spec directory are copied. Is this a bug, a feature or should I solve this in another way?

Tom

File.getCanonicalPath() throws IOException on Windows if File was constructed from URI string

I'm getting an IOException trying to run anything newer than 1.0.2-beta2 on Windows XP.

[INFO] The jasmine-maven-plugin encountered an exception:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
        at java.io.WinNTFileSystem.canonicalize0(Native Method)
        at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
        at java.io.File.getCanonicalPath(File.java:559)
        at com.github.searls.jasmine.io.RelativizesFilePaths.relativize(RelativizesFilePaths.java:15)
        at com.github.searls.jasmine.io.scripts.RelativizesASetOfScripts.relativize(RelativizesASetOfScripts.java:17)
        at com.github.searls.jasmine.CreatesManualRunner.scriptsForRunner(CreatesManualRunner.java:43)
        at com.github.searls.jasmine.CreatesManualRunner.create(CreatesManualRunner.java:34)
        at com.github.searls.jasmine.GenerateManualRunnerMojo.run(GenerateManualRunnerMojo.java:15)
        at com.github.searls.jasmine.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:193)
        ...

It seems like this is due to using ConvertsFileToUriString.convert(file) for script files and later calling the equivalent of new File(theURIString).getCanonicalPath() in RelativizesFilePaths.relativize(). If the File is constructed using a URI object, however, things seem to work: new File(new URI(theURIString)).getCanonicalPath().

Keep up the good work! :)

ManualSpecRunner Does Not Match SpecRunner when using external javascript sources

I'm attempting to integrate jasmine with a legacy application that has its sources outside of the maven project. While, jasmine will run fine with the test goal, the jasmine:bdd goal will fail to load the sources external to the maven project. if the SpecRunner used full pathing, or at least had an option to generate full paths, rather than relative paths, this problem would go away.

Example POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.twofourone</groupId>
<artifactId>jasmine-tests</artifactId>
<version>2.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Some Javascript Tests</name>

  <properties>
    <legacy.js.src>${project.basedir}\..\my-legacy-app\src\includes\js</legacy.js.src>
  </properties>

<build>
    <plugins>
        <plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>1.0.2-beta-5</version>
            <executions>
                <execution>
        <id>jasmine</id>
                    <goals>
          <goal>generateManualRunner</goal>
          <goal>resources</goal>
          <goal>testResources</goal>
          <goal>test</goal>
          <goal>preparePackage</goal>
        </goals>
        <configuration>
          <jsSrcDir>${legacy.js.src}</jsSrcDir>
          <preloadSources>
            <source>jquery-1.5.1.min.js</source>
            <source>lib/jasmine-jquery-1.3.1.js</source>
          </preloadSources>
        </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Diff problem:

ManualSpecRunner:

<script type="text/javascript" src="../../src/test/javascript/lib/jasmine-jquery-1.3.1.js"></script>
<script type="text/javascript" src="../../src/test/javascript/my-specs.js"></script>

SpecRunner:

<script type="text/javascript" src="file:/C:/sandbox/jasmin-maven-plugin-bug/jasmine-tests/target/jasmine/src/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="file:/C:/sandbox/jasmin-maven-plugin-bug/jasmine-tests/target/jasmine/spec/lib/jasmine-jquery-1.3.1.js"></script>
<script type="text/javascript" src="file:/C:/sandbox/jasmin-maven-plugin-bug/jasmine-tests/target/jasmine/src/a.js"></script>
<script type="text/javascript" src="file:/C:/sandbox/jasmin-maven-plugin-bug/jasmine-tests/target/jasmine/src/b.js"></script>
<script type="text/javascript" src="file:/C:/sandbox/jasmin-maven-plugin-bug/jasmine-tests/target/jasmine/spec/my-specs.js"></script>

Certain HtmlUnit Exceptions aren't handled correctly

Maven yields Build Success even though an exception occurs during mvn test

[INFO] --- jasmine-maven-plugin:1.1.0:test (default) @ resourceplanning ---
[INFO] Executing Jasmine Specs
Jan 24, 2012 5:50:35 PM 
com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl 
runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: 
Wrapped com.gargoylesoftware.htmlunit.ScriptException: 
Wrapped java.lang.RuntimeException: java.io.FileNotFoundException: /home/otto/src/workspace/synRP/target/jasmine/src/lib/jQuery.js (No such file or directory)
[....]

== CALLING JAVASCRIPT ==

  function (evt) {
      var node = evt.currentTarget || evt.srcElement, contextName, moduleName, context;
      if (evt.type === "load" || (node && readyRegExp.test(node.readyState))) {
          interactiveScript = null;
          contextName = node.getAttribute("data-requirecontext");
          moduleName = node.getAttribute("data-requiremodule");
          context = contexts[contextName];
          contexts[contextName].completeLoad(moduleName);
          if (node.detachEvent && !isOpera) {
              node.detachEvent("onreadystatechange", req.onScriptLoad);
          } else {
              node.removeEventListener("load", req.onScriptLoad, false);
          }
      }
  }

======= EXCEPTION END ========
== CALLING JAVASCRIPT ==

  function () {
      ctx.requireWait = false;
      ctx.takeGlobalQueue();
      if (!ctx.scriptCount) {
          ctx.resume();
      }
      req.checkReadyState();
  }

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

jasmine 
  has require
  loads synRP module
  loads underscore

Results: 4 specs, 0 failures

[...]

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

If a throw "foo" statement is encountered, the build fails as expected.

StringIndexOutOfBoundsException (-1) somewhere in jasmine:generateManualRunner

I should start out by saying that my configuration is probably flawed. I don't know how to diagnose the problem without more information, though. Even maven -X doesn't give me any more detail than this:
[INFO] [jasmine:generateManualRunner {execution: default-cli}]
[INFO] Generating a Spec Runner in the project's source test/spec directory that can be executed manually to facilitate faster feedback.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] : java.lang.StringIndexOutOfBoundsException: String index out of range: -1
JavaScript Test execution failed.

Failed to execute generated SpecRunner.html
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.BuildFailureException: JavaScript Test execution failed.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoFailureException: JavaScript Test execution failed.
        at searls.jasmine.GenerateManualRunnerMojo.execute(GenerateManualRunnerMojo.java:26)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Aug 02 10:37:25 EDT 2010
[INFO] Final Memory: 9M/23M
[INFO] ------------------------------------------------------------------------

Preload sources for test-scoped dependencies

Preload sources only works for dependencies residing in the production jsSrcDir directory. A similar mechanism should be available for preloading test-scoped sources (like, say, jasmine-jquery).

Formalize a spec runner template, allow users to override

Right now the 'template' for the SpecRunner HTML files is stored inline in some Java. This should be pulled out to an external file or template, and perhaps loaded from the classpath in such a way that users of the plugin can override it. This way, when a limitation of the plugin prevents folks from getting a particular dependency loaded, they could resort to overriding the spec runner template.

Doucmentation on junit-xml output

Hello;

I have spent a while trying to understand how to use the TEST-jasmine.xml output for maven site report generation. My current solution is to set this configuration:

                        <!-- publish the results in the surfire folder so that they are in the site report -->
                        <junitXmlReportFileName>../surefire-reports/TEST-jasmine.xml</junitXmlReportFileName>

Can you address in the documentation how best to do this. Im not sure if there is a better way?. If not, maybe you could change the default location - I'm not sure why else you'd want the XML aside from report generation. Any suggestions on best practice for getting the XML into the site reports welcomed.

Thanks :)

cannot copy json resources from src/test/javascript to target/jasmine

Hello,
I have js tests that use pre-canned JSON requests to answer AJAX calls from the code. However, when I put these files in src/test/javascript or src/main/javascript they are not processed by Jasmine plugin and do not appear in target/jasmine. An easy workaround to this issue is using maven-resources-plugin to copy needed files, but this add more noise to the POM.

Of course, I may be missing something obvious...

Thanks
Arnaud

mvn jasmine:bdd not working with configuration

Hey,

I've setup the plugin and I have several tests working running mvn jasmine:test. If I directly hit

/target/jasmine/ManualSpecRunner.html

it's also working. But when I run mvn jasmine:bdd my source and spec directories are not reflecting my pom.xml configuration. This is what my pom.xml configuration looks like. Any ideas?

    <plugin>
            <groupId>com.github.searls</groupId>
            <artifactId>jasmine-maven-plugin</artifactId>
            <version>1.0.2-beta-5</version>             
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <browserVersion>INTERNET_EXPLORER_7</browserVersion>
                <jsSrcDir>${project.basedir}/src/main/webapp/javascript</jsSrcDir>
                <jsTestSrcDir>${project.basedir}/src/test/javascript</jsTestSrcDir>
                <sourceIncludes>
                    <include>ecommerce/lib/jquery-1.6.1.min.js</include>
                    <include>ecommerce/lib/underscore-min.js</include>
                    <include>ecommerce/lib/*.js</include>
                    <include>ecommerce/**/*.js</include>
                    <include>socialfoundation/lib/*.js</include>
                    <include>socialfoundation/**/*.js</include>
                </sourceIncludes>
            </configuration>
          </plugin>

Thanks

Allow character set to be configurable

To change the character set, you need to overwrite SpecRunner.html and add a line

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

This could be configurable (or maybe it could be taken from <project.build.sourceEncoding> in pom.xml ?)

HTMLUnit error when loading YUI3 library

Is this due to the limitations of HTMLUnit trying to process a large javascript library like YUI3?

[ERROR] Caused by: com.gargoylesoftware.htmlunit.ScriptException: Exceeded maximum stack depth (file:/C:/perforce/se/development/site/web/HEAD/sports-web/target/jasmine/src/page/js/yui-bundle.js#34)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:531)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:906)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventListeners(EventListenersContainer.java:164)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:223)
[ERROR] at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:696)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:885)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:890)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1156)
[ERROR] at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:212)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:436)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307)
[ERROR] at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:38)

exception in windows

i tried both from scratch with project created via archetype, and adding the plugin to an existing project. in both cases i got exception when trying to build. (example stacktrace below.)

it might be something with my environment, but in case it isn't: here's this issue report...

plugin was recently downloaded from github (the big download button), i.e., a few days ago. so it might be related to http://github.com/searls/jasmine-maven-plugin/issues/issue/1, but i'm not sure...

i ran mvn from an ms-dos prompt.

the existing project was pretty "naked" java-wise, just containing javascript code.

a stacktrace:

[INFO] [jasmine:resources {execution: default}]
[INFO] Processing JavaScript Sources
[FATAL ERROR] searls.jasmine.ProcessResourcesMojo#execute() caused a linkage error (java.lang.NoClassDefFoundError) and may be out-of-date. Check the realms:
[FATAL ERROR] Plugin realm = app0.child-container[searls:jasmine-maven-plugin:1.0.0-SNAPSHOT]
urls[0] = file:/C:/Users/ingvald/.m2/repository/searls/jasmine-maven-plugin/1.0.0-SNAPSHOT/jasmine-maven-plugin-1.0.0-SNAPSHOT.jar
urls[1] = file:/C:/Users/ingvald/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/c:/dev/maven/lib/maven-2.2.1-uber.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] org/apache/commons/io/filefilter/FileFilterUtils org.apache.commons.io.filefilter.FileFilterUtils
[INFO] ------------------------------------------------------------------------
[INFO] Trace java.lang.NoClassDefFoundError: org/apache/commons/io/filefilter/FileFilterUtils
    at searls.jasmine.fileio.DirectoryCopier.copyDirectory(DirectoryCopier.java:16)
    at searls.jasmine.ProcessResourcesMojo.execute(ProcessResourcesMojo.java:25)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.filefilter.FileFilterUtils
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
    at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
    at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
    at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 21 more

Cast Error when running jasmine:test

I can run jasmine:bdd just fine. Running jasmine:test results in this stacktrace:

[ERROR] Failed to execute goal com.github.searls:jasmine-maven-plugin:1.0.2-beta-5:test (default) on project LifeNearMe: The jasmine-maven-plugin encountered an exception:
[ERROR] java.lang.RuntimeException: java.lang.ClassCastException: net.sourceforge.htmlunit.corejs.javascript.Undefined cannot be cast to java.lang.Boolean
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:47)
[ERROR] at com.github.searls.jasmine.TestMojo.executeSpecs(TestMojo.java:56)
[ERROR] at com.github.searls.jasmine.TestMojo.run(TestMojo.java:33)
[ERROR] at com.github.searls.jasmine.AbstractJasmineMojo.execute(AbstractJasmineMojo.java:193)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:601)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR] at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:601)
[ERROR] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
[ERROR] Caused by: java.lang.ClassCastException: net.sourceforge.htmlunit.corejs.javascript.Undefined cannot be cast to java.lang.Boolean
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.executionFinished(SpecRunnerExecutor.java:94)
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.waitForRunnerToFinish(SpecRunnerExecutor.java:68)
[ERROR] at com.github.searls.jasmine.runner.SpecRunnerExecutor.execute(SpecRunnerExecutor.java:39)
[ERROR] ... 30 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

any ideas?

running individual tests

Good work on the new release.
Is it possible to run individual tests by maybe defining a property using -D option?

kind regards,
adam

Path to javascript src directory is different between jasmine:bdd and jasmine:test

Hello, thanks so much for sharing this maven plugin. I am trying to integrate this into an Ext JS 4 project. Ext JS uses dynamic loading ( in development mode ) of it's various components...so it needs to know where those files are on the server relative to the html file that is running it. I configure Ext JS like this.

Ext.Loader.setPath('Ext', 'ext/src');

What I'm finding is that the relative urls are different between running jasmine:bdd and jasmine:test.

Here's my configuration:'

<configuration>
    <jsSrcDir>${project.basedir}/src/main/webapp</jsSrcDir>
    <sourceIncludes>
        <include>ext/ext-debug.js</include>
        <include>ucas/utils.js</include>
        <include>ucas.js</include>
    </sourceIncludes>
</configuration>

When I run mvn jasmine:bdd the path to ext-debug.js is:

http://localhost:8234/src/main/webapp/ext/ext-debug.js

and the file is served out of the src directory here:

${project.basedir}/src/main/webapp/ext/

but when I run mvn jasmine:test, that url path is different since it runs out of target.

The same file is now located at the relative url ( Notice no main/webapp ):

[HEADLESS SERVER]/src/ext/ext-debug.js

because it is serving it out of:

target/jasmine/src/ext

This may not be an issue for others. But because Ext JS goes after it's own source files with relative paths, I have to change the configuration of Ext if doing BDD vs running on my CI.

What would you recommend the best way to deal with this issue?

I'm thinking about trying to use a custom spec runner file and trying to configure Ext "on the fly" with the correct path based on whether I'm running in bdd mode or in test mode ( headless ).

Anyway, if you have any suggestions I'd love to hear about it. Otherwise, I'll share any solution that I come up with.

Cheers,
Dehru

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.