Coder Social home page Coder Social logo

Comments (9)

searls avatar searls commented on July 24, 2024

Apologies for not getting back to you -- jetty was added to the project only very recently. Prior to that I really didn't want to add a server at all, which is why jasmine:test (still) loads scripts over the file protocol.

However, HtmlUnit seems to really not care about the AJAX over file:/, in fact I've seen several projects that perform AJAX locally. It's probably the case that extjs includes some edge case that HtmlUnit can't handle.

In any case, hopefully in the near future I'll be able to address this by spinning up Jetty again for jasmine:test and making the executor pluggable.

from jasmine-maven-plugin.

gantaa avatar gantaa commented on July 24, 2024

I am having the same problem. When running mvn jasmine:test, the files are deployed to my project's /target/jasmine/src and /target/jasmine/spec directories. When running mvn jasmine:bdd, The files are deployed to jetty with the relative path from the root of my webapp. ie: localhost:8234/web/WEB-INF/js-src and localhost:8234/web/WEB-INF/js-test. Because I am using requireJS with a configuration that points to paths, I am required to add the plugin twice to my pom to do mvn builds and TDD. One configuration for the bdd goal that excludes the test goal config file, and one configuration for test that excludes the bdd goal config file. Can I have different excludes for different goals in one pom plugin declaration? Here is a snippet from my resulting pom:

     <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>web/WEB-INF/js-src</jsSrcDir>
                    <jsTestSrcDir>web/WEB-INF/js-test</jsTestSrcDir>
                    <customRunnerTemplate>web/WEB-INF/js-test/jasmine-template.html</customRunnerTemplate>
                    <specExcludes>
                        <exclude>**/*Test.js</exclude>
                        <exclude>**/jasmine-bdd-test-config.js</exclude>
                    </specExcludes>
                    <sourceExcludes>
                        <exclude>LNM-Main.js</exclude>
                        <exclude>jasmine-config.js</exclude>
                        <exclude>factory.js</exclude>
                        <exclude>control/*.js</exclude>
                        <exclude>model/*.js</exclude>
                        <exclude>view/*.js</exclude>
                    </sourceExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.searls</groupId>
                <artifactId>jasmine-maven-plugin</artifactId>
                <version>1.0.2-beta-5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bdd</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jsSrcDir>web/WEB-INF/js-src</jsSrcDir>
                    <jsTestSrcDir>web/WEB-INF/js-test</jsTestSrcDir>
                    <customRunnerTemplate>web/WEB-INF/js-test/jasmine-template.html</customRunnerTemplate>
                    <specExcludes>
                        <exclude>**/*Test.js</exclude>
                        <exclude>**/jasmine-mvn-test-config.js</exclude>
                    </specExcludes>
                    <sourceExcludes>
                        <exclude>LNM-Main.js</exclude>
                        <exclude>jasmine-config.js</exclude>
                        <exclude>factory.js</exclude>
                        <exclude>control/*.js</exclude>
                        <exclude>model/*.js</exclude>
                        <exclude>view/*.js</exclude>
                    </sourceExcludes>
                </configuration>
            </plugin>
     </plugins>

from jasmine-maven-plugin.

dehru avatar dehru commented on July 24, 2024

gantaa,
Whether this is the right way to use profiles or not, I am using profiles to configure the plugin differently. I still don't have jasmine:test working like I want yet, but am doing a lot of bdd now. So when I run jasmine, I just pass in the profile to mvn like

mvn jasmine:bdd -PjasmineBdd
or
mvn jasmine:test -PjasmineTest

from jasmine-maven-plugin.

johanhaleby avatar johanhaleby commented on July 24, 2024

I've written a blog on how to work-around this issue. You can read it here: http://blog.jayway.com/2012/04/17/configuring-jasmine-to-work-with-maven-and-jquery-fixtures/

from jasmine-maven-plugin.

searls avatar searls commented on July 24, 2024

@johanhaleby Part of the reason I don't care to spend much time on this issue is that I don't believe unit tests should read from the file system or talk over the network; if they don't, this isn't an issue, right? Is anyone experiencing problems for reasons other than this?

In particular, I think jasmine-jquery's functionality of loading fixtures from external files is a really bad idea and would suggest folks set up their fixtures within their specs (to do so succinctly, I wrote jasmine-fixture).

from jasmine-maven-plugin.

dehru avatar dehru commented on July 24, 2024

@searls - Early in the project when I was integrating Jasmine and Extjs we really only worked in "development mode". During development mode, Extjs loads it's hundreds of components dynamically depending on what's required. This works great with jasmine:bdd but not with jasmine:test because of the "file:" protocol issue.

This may NOT be a problem for us now that we have finally implemented "production mode" and all our javascript gets aggregated and doesn't use any dynamic loading of components. So I'm thinking jasmine:test running our aggregated/compressed javascript should be fine. I'll let you know.

from jasmine-maven-plugin.

searls avatar searls commented on July 24, 2024

@dehru so Extjs's dependency loading mechanism was the culprit? I've never really used itβ€”is flicking on "production mode" a non-trivial thing for an extjs user to do?

from jasmine-maven-plugin.

dehru avatar dehru commented on July 24, 2024

@searls - If memory serves me correctly from 7 months ago I think I determined that was the culprit. In order to turn on production mode, Sencha (creators of Extjs) provide a build tool which we had not integrated yet at the time I originally posted this. I wouldn't say it's non-trivial for an extjs user, but I would expect every production Extjs app to integrate it early in development. I'm hoping next week I can try to resurrect jasmine:test from the dead on this project and let you know if that has solved our problem.

from jasmine-maven-plugin.

klieber avatar klieber commented on July 24, 2024

This should now be resolved by pull request #145

from jasmine-maven-plugin.

Related Issues (20)

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.