茉莉花没有定义 [英] jasmine is not defined

查看:76
本文介绍了茉莉花没有定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用friby.js和Jasmine在Enide Studio上运行rest API测试.

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

我收到此错误:

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)

我在记事本中尝试了相同的脚本并使用CLI运行,效果很好.

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

请帮助我,因为我需要在IDE上运行它.

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

推荐答案

迁移到Jasmine 2.x之后,我遇到了类似的问题.很明显,Frisby当前不支持2.x. 虽然,在 https://github.com/m0x72/frisby 上的frisby分支解决了这一难题.

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');

这篇关于茉莉花没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆