我试图配置Karma使用jasmine-jquery但没有成功...
在我的karma.conf.js文件中,我配置了框架:
frameworks: ['jasmine'],
Run Code Online (Sandbox Code Playgroud)
并加载了所需的依赖项:
files: [
'../bower_components/jquery/dist/jquery.js',
'../bower_components/jasmine-jquery/lib/jasmine-jquery.js',
...
Run Code Online (Sandbox Code Playgroud)
但是当我使用grunt测试运行我的测试时,我有以下内容:
TypeError: undefined is not a function
at null.<anonymous> (/home/sofarell/workspace/myapp/bower_components/jasmine-jquery/lib/jasmine-jquery.js:352:13)
Run Code Online (Sandbox Code Playgroud)
看一下jasmine-jquery.js的源代码,看起来好像没有找到jasmine引用,因为在jasmine之前加载了jasmine-jquery:
351. beforeEach(function () {
352. jasmine.addMatchers({
353. toHaveClass: function () {
Run Code Online (Sandbox Code Playgroud)
还有其他人遇到过这个问题吗?有办法解决这个问题吗?