Karma插件'jasmine-matchers'添加到karma.conf.js框架中,仍未在单元测试中加载

时间:2015-11-20 01:13:38

标签: angularjs npm jasmine karma-runner karma-jasmine

我无法找到关于此问题的大量文档。尽管安装了karma-jasmine-matchers并将其包含在框架per instruction中,但我仍然无法使用任何提供的方法。有没有人遇到这个问题并找到了解决方案?

 module.exports = function(config) {
   config.set({
     // base path, that will be used to resolve files and exclude
     basePath: '',

     // testing framework to use
     frameworks: [
       'jasmine',
       'jasmine-matchers'
     ],

     more config stuff...

使用任何方法运行测试时得到的错误是:

 "TypeError: 'undefined' is not a function (evaluating 'expect({
   memberName: undefined
 }).toHaveMember('memberName')')"

更新version issue

1 个答案:

答案 0 :(得分:0)

我在https://github.com/JamieMason/Jasmine-Matchers/tree/master/examples/karma添加了一个工作示例,但看起来您还需要在插件下定义它。似乎任何插件是在业力中定义的,他们都需要定义。