Getting Jasmine to work on the server side

I am trying to start testing JavaScript on the server side using Node.JS

I use grunt and grunt-jasmine-node , but I cannot get it to run my tests.

He just writes

PS C: \ Development \ NET \ Source \ jsn> grunt Run jasmine_node task undefined

Finished in 0.001 seconds 0 tests, 0 claims, 0 failures

Finish without error.

This is my Gruntfile.js

 module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jasmine_node: { specNameMatcher: 'spec', projectRoot: '.', requirejs: false, forceExit: true, jUnit: { report: false, savePath : "./build/reports/jasmine/", useDotNotation: true, consolidate: true } } }); grunt.loadNpmTasks('grunt-jasmine-node'); grunt.registerTask('default', 'jasmine_node'); }; 

And my file structure is this:

enter image description here

So what am I doing wrong?

It, like the stub.js file, is never loaded because it has a console.log call to check this.

+7
source share
1 answer

Or:

  • Make sure the extension is for your javascript .spec.js test .spec.js

or

  • Replace specNameMatcher configuration specNameMatcher with matchall: true
+6
source

All Articles