簡體   English   中英

在grunt-contrib-jasmine任務中運行jasmine-jquery時出錯

[英]Error running jasmine-jquery in grunt-contrib-jasmine task

我正在嘗試在單元測試中使用jasmine-jquery來測試BackboneJS視圖,但是在嘗試運行測試時出現以下錯誤:

運行“ jasmine:src”(茉莉花)任務

通過PhantomJS測試茉莉花規格

TypeError:“未定義”不是對象(評估“ jasmine.spiedEventsKey =函數(選擇器,事件名稱){返回[$(selector).selector,事件名稱] .toString()}”)

測試/供應商/茉莉jquery主/ lib /茉莉jquery.js:40

測試/供應商/jasmine-jquery-master/lib/jasmine-jquery.js:34

測試/供應商/jasmine-jquery-master/lib/jasmine-jquery.js:838

我正在使用grunt,phantomjs,grunt-contrib-jasmine任務和grunt-template-jasmine-requirejs。

這是我的咕unt配置

    jasmine : {
        src : 'lib/**/*.js',
        options : {
            vendor: [
                'test/vendor/Sinon/sinon-1.14.1.js',
                'test/vendor/jasmine-jquery-master/vendor/jquery/jquery.js',
                'test/vendor/jasmine-jquery-master/lib/jasmine-jquery.js'
            ],
            specs: 'test/spec/**/*.js',
            helpers: 'test/helpers/**/*.js',
            template: require('grunt-template-jasmine-requirejs'),
            templateOptions: {
                requireConfigFile: 'lib/js/main.js',
                requireConfig: {
                    baseUrl: './lib/js/',
                    paths: {
                        'app': 'app',
                        'router': 'router',
                        'text': './text-master/text',
                    }
                }
            }
        }
    },

我設置不正確嗎?還是無法無目的地運行jasmine-jquery?

謝謝

我遇到了同樣的問題。 通過在我的karma.conf.js文件中以不同順序包含框架來karma.conf.js

錯誤:

frameworks: ['phantomjs-shim', 'jasmine', 'jasmine-jquery']

正確:

frameworks: ['phantomjs-shim', 'jasmine-jquery', 'jasmine']

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM