Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jasmine no specs found with more than 13 specs

Jasmine is reporting a no specs found message after adding a 14th spec to it (doesn't matter if it is a copy of a working spec). If I use a self made reporter it shows that it went through all the specs no problem but that it reports a no specs found as end result.

added a console log to show what I mean

Started
[#quickSort]

Results               Top Level Tests
-------               ---------------
.Passed                should sort small array
.Passed                should hallo small array
.Passed                should sort array with identical values
.Passed                should do nothing with empty array
.Passed                shouldn't sort a string
.Passed                should do nothing with array with single field

Group "#quickSort" was finished


[#signature]

Results               Top Level Tests
-------               ---------------
[#signature Write signatureformat Remove]

Results               Top Level Tests
-------               ---------------
.Passed                Compact 1/2; Remove additional x/y members
.Passed                Compact 2/2; Also remove additional x/y members in sequential paths

Group "Write signatureformat Remove" was finished


[#signature Write signatureformat Reposition]

Results               Top Level Tests
-------               ---------------
.Passed                Reposition 1/2; Reposition top-left to 0,0 for more compact output
.Passed                Reposition 2/2; Reposition top-left to 0,0 for more compact output

Group "Write signatureformat Reposition" was finished


[#signature Write signatureformat Downscale]

Results               Top Level Tests
-------               ---------------
.Passed                Downscale 1/2; Downscale when needed with minimal resolution loss, so it will never get to large (-2000..2000)
.Passed                Downscale 2/2; Downscale when needed with minimal resolution loss, so it will never get to large (-2000..2000)

Group "Write signatureformat Downscale" was finished


.Passed                Write signatureformat - Complex export
.Passed                Write signatureformat - Rotate 180 degrees

Group "#signature" was finished


Started


No specs found
Finished in 0.002 seconds

Also here is the source of the spec_runner

//var exit = require('exit');
var Jasmine = require('jasmine'),
    reporters = require('jasmine-reporters');

var junitReporter = new reporters.NUnitXmlReporter({
  savePath: __dirname,
  consolidateAll: true
});

var myReporter = {

    jasmineStarted: function (suiteInfo) {
    },
    suiteStarted: function (result) {
        console.log('[' + result.fullName + ']');
        console.log('');
        console.log('Results               Top Level Tests');
        console.log('-------               ---------------');
    },
    specStarted: function (result) {
    },
    specDone: function (result) {
        var line = result.status.substr(0, 1).toUpperCase() + result.status.substr(1);
        if (line === "Failed") line = "+" + line;
        while (line.length < 22) line += " ";
        console.log(line + result.description);
    },
    suiteDone: function (result) {
        console.log('');
        console.log('Group "' + result.description + '" was ' + result.status);
        for (var i = 0; i < result.failedExpectations.length; i++) {
            console.log('AfterAll ' + result.failedExpectations[i].message);
            console.log(result.failedExpectations[i].stack);
        }
        console.log('');
        console.log('');

        // werkt gewoon niet???? [rv]
        //if (result.status !== "passed") exit(1)
    },
    jasmineDone: function () {
    }
};

var jasmine = new Jasmine();
jasmine.loadConfigFile("spec/support/jasmine.json");
jasmine.addReporter(myReporter);
jasmine.execute();
like image 728
Strike08 Avatar asked Dec 05 '22 14:12

Strike08


2 Answers

Fixed it. Problem was in package.json. I used "scripts":{"test": "jasmine spec/spec_runner.js"}

This caused jasmine to run 2 times. Fixed it by using

"scripts":{"test": "node spec/spec_runner.js"}

like image 200
Strike08 Avatar answered Dec 21 '22 21:12

Strike08


Make sure that your application compile successfully prior to try running tests.

Example

I had this error today, for me it was that I had a syntax-level error in my .ts files, so they couldn't really compile.

In above situation, I think, the tests should not start (and instead show compile error).

But for whatever reason, somehow the tests start, and Jasmine fails with "No specs found" log.

like image 28
Gi1ber7 Avatar answered Dec 21 '22 21:12

Gi1ber7