jasmine is not defined

2019-09-03 20:34发布

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条回答
Bombasti
2楼-- · 2019-09-03 21:07

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');
查看更多
登录 后发表回答