How I can test nodejs backend code using qunit & grunt. In Gruntfile.js how to specify only the js files, So in qunit repo, the sample Gruntfile.js tells about creating html files and there speI am able to see example of html files which can be tested with grunt, but if I want to test only nodejs backend java script files, then how I can use that? Can someone point to some sample snippent of Gruntfile for this?
My Gruntfile.js looks as below:
module.exports = function( grunt ) {
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-contrib-qunit" );
grunt.loadNpmTasks( "grunt-contrib-watch" );
grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ),
qunit: {
qunit: [
"src/test.js"
]
},
watch: {
files: [ "*", ".jshintrc", "{src,test}/**/{*,.*}" ],
tasks: "default"
}
});
grunt.registerTask( "build", [ "qunit" ] );
};
And my test.js file looks to be as below:
test("testing", function(assert) {
var val1 = 10;
equal(10, val1, "We expect to be 10");
});
But while running "grunt qunit", it is giving below error:
Testing src/test.js
>> PhantomJS timed out, possibly due to a missing QUnit start() call.
Warning: 1/1 assertions failed (0ms) Use --force to continue.
Aborted due to warnings.
Please let me know the correct way to mention in Gruntfile.
With regards, -M-