jasmine-contrib / grunt-jasmine-node

Grunt task for running jasmine-node
MIT License
67 stars 99 forks source link

grunt not picking up jasmine test - 0 specs #25

Open ctippur opened 11 years ago

ctippur commented 11 years ago

Hello -

I am not sure if I am doing it right but when I run "grunt jasmine:test" I get ..

Running "jasmine:test" (jasmine) task Testing jasmine specs via phantom

0 specs in 0.058s.

0 failures Here is the snippet of the specs file

jasmine : {
    test: {
        src : ['public/javascripts/**/*.js'],
        options : {
            specs : 'spec/client/**/*.js'
            , vendor: [
                  'public/vendor/jquery-2.0.2.min.js'
                , 'public/vendor/jasmine-jquery.js'
                , 'public/vendor/dust-core-1.2.3.min.js'
                , 'node_modules/requirejs/require.js'
                , 'vendor/bootstrap/js/bootstrap.min.js'
            ]
            , junit: {
                path: "./build/reports/jasmine/"
                , consolidate: true
            }
            , template: require('grunt-template-jasmine-istanbul')
            , templateOptions: {
                coverage: 'public/coverage/client/coverage.json'
                , report:   'public/coverage/client'
            }
        }
    }
},

Here are the contents of spec file ..

$ cat spec/client/loginfb1Spec.js

require(['request'], function(request){ describe('HTTP request', function () { it('responds with an "Example" page', function (done) { request('http://localhost:3000', function (err, response, body) { runs(function () { expect(err).toBeNull(); expect(response.statusCode).toEqual(200); expect(body).toContain('login-with-facebook.png'); expect(body).toContain('XX-with-facebook.png'); }); done(); }); }); }); });

Couple of observations:

I see that the _SpecRunner.html gets created during the run time but looks like it gets deleted. If my intentionally make a mistake on the spec file, it seem to pick that up and error out. Does this means that the spec file is being considered but not processed when it is right? Shekar

davidposin commented 11 years ago

I'm sure you figured this out by now, but just in case and to help anyone else who gets here asking the same question, the _SpecRunner.html is deleted by default. Set the options key 'keepRunner' to true to tell grunt to keep the _SpecRunner.html file alive.

s9tpepper commented 10 years ago

Hm, the 0 failures part is weird. But I had not noticed the _SpecRunner.html file at all to be honest. I've used the task mainly to run tests with Jenkins and output junit reports. I think the 0 failures might have been due to a bug that got fixed by a recent PR to fix the task from not failing if Jasmine actually failed a test. But I'm not entirely sure.