Comments (10)
I'll second this request! A workaround is to create a customRunnerTemplate in which the $sources$
variable is removed, and the app sources are hard-coded, as well as specifying require in sourceIncludes like <include>require.js</include>
. Then use require as in your example.
However, because the paths are all hard-coded, this can only be made to work for either the maven build, or the jasmine:bdd plugin (or maybe both if your directory structure matches the default: /src and /spec).
As grignaak mentions, having a
from jasmine-maven-plugin.
I'm currently working on adding this feature. It currently supports Require.js, but I've tried to make it easy to add other loaders.
Have a look at this example:
Basically I've refactored out the ScriptRunnerHtmlGenerator into an abstract class, and added a Default implementation and a RequireJs impl that uses different templates. The example above works with both the test goal and the jasmine:bdd.
I'm currently testing the plugin in one of our projects, and if it's stable I'll open a pull request.
from jasmine-maven-plugin.
I've added support for more advanced configuration:
jasmine-webapp-advanced-requirejs
Since there are literally millions of ways to configure scriptloaders like require.js, I think the best way to add this feature is to make it configurable within reason. The example shows how one can wrap dependencies like jQuery, and use the order plugin to evaluate scripts in the correct order. (For example jQuery needs to be resolved before any plugins etc.)
Feedback on where to draw the line when it comes to configurability is welcomed!
from jasmine-maven-plugin.
I am getting Mismatched anonymous define() exceptions when running a Backbone + require.js app via jasmine:test.
I am using version 1.0.2-beta-5 of the plugin. Are these issues also fixed in the newer SNAPSHOT releases?
from jasmine-maven-plugin.
@timowest 1.0.2-beta-5 does not support require.js, I've added support in this branch https://github.com/ebaxt/jasmine-maven-plugin/tree/advancedRequirejsExample but haven't opened a pull request yet because of lacking documentation. Also that branch uses a bundled requires.js script, but it makes more sense to bring your own version and let the plugin refere to that (since you need requires.js to load scripts in the first place).
We are using this branch in our system and it's been stable, so once I've resolved the issues mentioned above, I'll open a pull request. In the mean time you can look at this example to get it working: https://github.com/ebaxt/jasmine-maven-plugin/tree/advancedRequirejsExample/src/test/resources/examples/jasmine-webapp-advanced-requirejs
from jasmine-maven-plugin.
@ebaxt Thanks, I managed to fix the issue temporarily by wrapping the test execution in the runner HTML via require.
from jasmine-maven-plugin.
Here is the pull request: #50
from jasmine-maven-plugin.
I've been struggling with this issue myself recently, and I'm glad to see you're working on this :-).
from jasmine-maven-plugin.
Thanks for working on this. This would be an immense help for me.
from jasmine-maven-plugin.
I've merged in @ebaxt's pull request. The next release will include the feature.
from jasmine-maven-plugin.
Related Issues (20)
- Jasmine-Maven plugin error in Windows platform HOT 1
- antlr error HOT 1
- ReferenceErrors when running in Jenkins with symlinked JENKINS_HOME HOT 3
- How to use phantomjs 2.1.1 HOT 1
- Jenkins Maven Integration with Jasmine broken since 2.2 (Test results not shown) HOT 2
- Cannot make it work with ManualSpecRunner HOT 2
- Allow users to configure tests to run in a random order HOT 2
- turnoff the default reports generated by this plugin and print only the custom reporter messages HOT 1
- Can't customize ChromeDriver on 3.0-alpha-01 HOT 2
- Update the github pages site HOT 1
- Unable to set WebDriver IE specific capability ignoreProtectedModeSettings HOT 2
- Chrome version 74 HOT 4
- The documentation page is down HOT 3
- Blocked testing with latest version HOT 11
- Cannot make it work with RemoteWebDriver and Docker HOT 5
- timeout error after waiting for 300 sec with version 3.0-beta-01 HOT 2
- jasmine:bdd (version 3.0-beta-01) opens browser but jetty gives 403 HOT 3
- Broken link for usage page HOT 2
- The link to documentation at github is broken. HOT 5
- plugin doesn't work with Chrome version 117 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasmine-maven-plugin.