Getting Jasmine to run on the server-side

gruntjs, jasmine, javascript, node.js, unit-testing

Solution

Either:

- Make sure the extension to your javascript test specs is `.spec.js`

Or

- Replace the configuration option `specNameMatcher` with `matchall: true`

Problem

I'm trying to get started on testing JavaScript on the server-side with Node.JS I'm using grunt, and grunt-jasmine-node, but I can't get it to run my tests. It just logs PS C:\Development\NET\Source\jsn> grunt Running "jasmine_node" task undefined Finished in 0.001 seconds 0 tests, 0 assertions, 0 failures Done, without errors. 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: So, what am I doing wrong? It's like the `stub.js` file isn't ever even loaded, because it has a `console.log` call in it to test that.

Original source