How can I confirm what version of Jasmine I'm using?

Solution 1:

To simply log the version number try:

   if (jasmine.version) { //the case for version 2.0.0
       console.log('jasmine-version:' + jasmine.version);
    }
    else { //the case for version 1.3
       console.log('jasmine-version:' + jasmine.getEnv().versionString());
    }

I use this little helper function:

 this.isJasmineV2 = function () {
        return (jasmine.version && jasmine.version.charAt(0) === "2");
        //version 1.3 uses this syntax: jasmine.getEnv().versionString()
    };

Solution 2:

command line command:

Detailed view:

npm view jasmine

or

Version Number:

npm view jasmine version

Solution 3:

describe('Test to print out jasmine version', function() {
it('prints jasmine version', function() {
        console.log('jasmine-version:' + jasmine.getEnv().versionString());
    });
});

Source: Updating the version of Jasmine used in karma-jasmine

Solution 4:

Judging by the code

jasmine.version

should give you the version string.