如何确认我正在使用的Jasmine版本?

时间:2022-07-14 07:15:15

If I recall there is a command in Jasmine that will log the exact version of Jasmine I'm running to the console, but I can't remember what it is. I am positive I have seen this before somewhere, and now that I actually need it I can't find it anywhere. Does anyone know what it is?

如果我记得在Jasmine中有一个命令会将我正在运行的Jasmine的确切版本记录到控制台,但我不记得它是什么。我很肯定我在某个地方见过这个,现在我真的需要它,我无法在任何地方找到它。有谁知道它是什么?


Edit: The posted solution of using jasmine.getEnv().versionString() isn't working - to any mods reading this, would fixing that issue be better to start as a new question, or continue here?

编辑:使用jasmine.getEnv()。versionString()的已发布解决方案无法正常工作 - 对于任何阅读此内容的mod,将更好地解决该问题作为一个新问题开始,还是继续在这里?

4 个解决方案

#1


43  

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()
    };

#2


33  

command line command:

命令行命令:

Detailed view:

详细视图:

npm view jasmine

or

要么

Version Number:

版本号:

npm view jasmine version

#3


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

来源:更新karma-jasmine中使用的Jasmine版本

#4


3  

Judging by the code

从代码判断

jasmine.version

should give you the version string.

应该给你版本字符串。

#1


43  

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()
    };

#2


33  

command line command:

命令行命令:

Detailed view:

详细视图:

npm view jasmine

or

要么

Version Number:

版本号:

npm view jasmine version

#3


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

来源:更新karma-jasmine中使用的Jasmine版本

#4


3  

Judging by the code

从代码判断

jasmine.version

should give you the version string.

应该给你版本字符串。