What is the best place to put the Jasmine files (libs, specs, SpecRunner.html)
in a symfony project?
I would make in this way:
the jasmine libs in web/vendor/js
the spec files in src/myProject/WebBundle/Resources/public/js
and the SpecRunner.html I have no idea.
Since Jasmine is used just for testing your JavaScript code, I don't think it is a good idea to put libraries and spec files in the public.
I would put them in src/myProject/WebBundle/Resources/
src/myProject/WebBundle/Resources/js/lib/jasmine
src/myProject/WebBundle/Resources/js/spec
Related
I am working on large scale web app using AngularJs as front-end and Laravel RESTful API as back-end
Currently I am using gulp to concatenate all script files in one file including angular libraries and all modules and controllers and it's about 46,000 line of code.
Is this a good approach regrading performance?, or I've to include all script files separately.
Also Is concatenating some files and including the others is a good approach?
Thanks in advance!
Yes it is a standard approach for production
For development keep seperate files so debugging is a lot easier.
For production it is highly advisable to combine all the files and minify it.
Infact if you use webpack you can have all css , js files in one bundle
Webpack is awesome tool. Gulp would also do the job.
I am using Webstorm a start a angularjs project. I've created a lot of *.js files. I have the include them using the tag one by one in the html files. whenever I created a new js file, I have to create the script tag.
The things I needed is just like gulp-concat, but without minifying. minified code are hard to debug.
Can anyone help on this? Thanks!
WebStorm doesn't have any built-in functions for combining files... But there are plenty of different tools on the web - plus you can create your own batch files for this.
I can suggest using Grunt grunt-contrib-concat task (https://github.com/gruntjs/grunt-contrib-concat). It supports merging files. You can run the task using Node.js run configuration, or configure it as a file watcher, or use Grunt console.
Browserify (http://browserify.org/) is one more way to go - it allows using commonjs-style syntax when developing front-end applications, combining the files into a single file for production
Or, try Webpack (https://webpack.github.io/) - it's a modern powerful module bundler
I'm writing an ember.js addon. When running ember test Ember will add generic should pass jshint tests to my test suite. That's great as far as it goes, but the javascript files from the main directory (index.js, Brocfile.js) are missing as are the files from app/**/*. As far as I can see, only files in addon/**/\ and tests/**/\ are covered.
Am I missing some obvious configuration option? Is this a bug?
No it is not a bug. That's how the ember test works.
Once there was an issue about running linter. But I didn't find any rfc about these issue.
If you want to run linting on your code base, you can use either cli or ide plugins.
I've seen many posts in stackoverflow about Grunt + Rails, but many cases asked about changes from Grunt.js to Rails asset pipeline, that is not my case.
My Gruntfile was set up to work with Mocha, in other words, just for test javascript codes.
So my doubt is: How the best way to organize my files into rails project?
I thought about creating a directory in my test path called "javascript" and put all test into there, after change options in Gruntfile.
Is this the best way?
We had some Jasmine specs in our recent rails project. You could follow Jasmine's convention:
project root/
spec/
javascript/
Since another JavaScript testing framework has already done what you are suggesting, creating a "javascript" folder in your "test" folder would work just fine.
I'm trying to use the jasmine-jquery plugin: https://github.com/velesin/jasmine-jquery. In the documentation it says to:
Simply download jasmine-jquery.js from the downloads page and include
it in your Jasmine's test runner file (or add it to jasmine.yml file
if you're using Ruby with jasmine-gem). Remember to include also
jQuery library as jasmine-jquery relies on it.
I'm trying to use this plugin to add fixtures to my jasmine tests in coffeescript for a coffeescript one page HTML5 canvas application. I'm using the jasmine-node version of jasmine to run my jasmine tests using node.js My issue with the above instructions is that I do not see a jasmine test runner file to edit, and as a result I'm unable to call methods from this plugin such as load_fixtures in my specs.
My current directory structure for the project is
coffescript/shape.coffee
index.html (An html file I would ideally like to use for my tests)
javascript/shape.js (The outputted coffeescript)
spec/shape.spec.coffee
spec/jasmine-jquery-1.3.1.js (The plugin)
Any insight is greatly appreciated as I've spent several hours trying to get this to work correctly. If you know a different test framework with fixtures that would be easier to setup for a coffeescript project that was also be welecomed. Thanks!
The library you are trying to use assumes that you are using jasmine in a html page. Neither it nor jquery will work with jasmine-node.
jQuery cannot work on node because it needs the browser's DOM api. There are some libraries that mock the DOM for node that might give you what you need.
The test runner file you refer to is included in the standalone version of Jasmine (SpecRunner.html). It is not part of Jasmine-node.