Protractor/Jasmine showing different versions - what am I doing wrong?

社会主义新天地 提交于 2019-12-10 21:06:08

问题


When I do this:

console.log('jasmine-version:' + jasmine.getEnv().versionString());

it prints: jasmine-version:1.3.1 revision 1354556913

When I run 'npm list jasmine-core' it prints:

server@0.0.1 /Users/xx/Desktop/workingDirectory
└── jasmine-core@2.1.3 

Why is one showing 2.1.3 and another showing 1.3.1?

I don't seem to have the features in 2.1.3, so it's running 1.3.1. How do I fix this?


回答1:


You have to specify that you want to use jasmine2 in the conf file. Please read the docs here: https://github.com/angular/protractor/blob/master/docs/jasmine-upgrade.md#in-your-conf-file.

Protractor supports both jasmine 1.3 and 2.x, and it's up to you to specify the version of jasmine you want to use. (Side note, 2.x is provided via jasmine-core, while 1.3 is provided via minijasminenode)

EDIT: another side note, protractor support for 2.x is not released until protractor 1.6 or if you use master




回答2:


This is my issue https://github.com/angular/protractor/issues/362

Looks like Jasmine2 was only checked in a few days ago.



来源:https://stackoverflow.com/questions/27835554/protractor-jasmine-showing-different-versions-what-am-i-doing-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!