jasmine is not defined

我们两清 提交于 2019-12-13 05:44:42

问题


I am trying to run a rest API test on Enide Studio using friby.js and Jasmine.

I got this error:

C:\Users\xxxx\AppData\Roaming\npm\node_modules\frisby\lib\frisby.js:1125
jasmine.Matchers.prototype.toMatchOrBeNull = function(expected) {
^
ReferenceError: jasmine is not defined
    at Object.<anonymous> (C:\Users\xxxx\AppData\Roaming\npm\node_modules\frisby\lib\frisby.js:1125:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\Users\xxxx\Desktop\Enide-Studio-2014.17-luna-SR1-win64\ws\SampleProject\.settings\sample_spec.js:4:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

I tried the same script in note pad and ran using CLI, it worked well.

Please help me as I need to run this on a IDE.


回答1:


I had similar problem after migrating to Jasmine 2.x. It became obvious that 2.x is currently not supported in Frisby. Although, a frisby fork at https://github.com/m0x72/frisby solves this probelem.

cd node_modules
git clone https://github.com/m0x72/frisby.git
npm install qs
npm install jsonschema
npm install stack-trace

You may include it in your test file as follows:

// var frisby = require('frisby');
var frisby = require('frisby-master');


来源:https://stackoverflow.com/questions/28375214/jasmine-is-not-defined

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