久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

JSHint 認為 Jasmine 函數(shù)未定義

JSHint thinks Jasmine functions are undefined(JSHint 認為 Jasmine 函數(shù)未定義)
本文介紹了JSHint 認為 Jasmine 函數(shù)未定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我有一個使用 Karma+Jasmine 和 JSHint 的 Grunt 設(shè)置.每當(dāng)我在我的規(guī)范文件上運行 JSHint 時,我都會收到一系列未定義"錯誤,其中大部分是 Jasmine 的內(nèi)置函數(shù).例如:

I've got a Grunt setup which uses Karma+Jasmine and JSHint. Whenever I run JSHint on my spec file, I get a series of "undefined" errors, most of which are for Jasmine's built-in functions. For example:

Running "jshint:test" (jshint) task

   js/main.spec.js
      3 |describe("loadMatrix()", function() {
         ^ 'describe' is not defined.
      4 |    it("should not assign a value if no arg is passed.", function() {
             ^ 'it' is not defined.

(我的規(guī)范要測試的 JS 文件中的變量和函數(shù)也有一些未定義的錯誤,但我不確定這是為什么,這可能是一個單獨的問題.)

(I also get some undefined errors for the variables and functions from the JS file that my spec is meant to test against, but I'm not sure why that is and it may be a separate issue.)

我的 Karma 配置文件中有 frameworks: [ "jasmine" ],我沒有為 JSHint 設(shè)置任何全局變量,也沒有 .jshintrc 文件,因為我在 Grunt 中配置它.我曾嘗試將 Jasmine 的函數(shù)作為 JSHint 全局變量添加到我的 Gruntfile 中,但是將它們設(shè)置為 truefalse 并沒有什么不同——錯誤仍然存??在JSHint 跑了.

My Karma config file has frameworks: [ "jasmine" ] in it, I don't have any globals set for JSHint, and I don't have a .jshintrc file since I'm configuring it in Grunt. I did try adding Jasmine's functions as JSHint globals in my Gruntfile at one point, but setting them as either true or false didn't make a difference—the errors still persisted when JSHint ran.

我錯過了什么?我似乎無法讓 JSHint 在我的規(guī)范文件中跳過對 Jasmine 函數(shù)的定義檢查.

What am I missing? I can't seem to do anything to get JSHint to skip definition checking for Jasmine's functions in my spec file.

推薦答案

MINOR CORRECTION - .jshintrc 文件中的 predef 周圍應(yīng)該有".

MINOR CORRECTION - there should be "" around predef in the .jshintrc file.

通過將其添加到我的 Gruntfile.coffee 中的 jshint 選項來修復(fù):

Fixed by adding this to the jshint options in my Gruntfile.coffee:

predef: [
    "jasmine"
    "describe"
    "xdescribe"
    "before"
    "beforeEach"
    "after"
    "afterEach"
    "it"
    "xit"
    "it"
    "inject"
    "expect"
    "spyOn"
]

.jshintrc:

"predef": [
    "jasmine",
    "describe",
    "xdescribe",
    "before",
    "beforeEach",
    "after",
    "afterEach",
    "it",
    "xit",
    "it",
    "inject",
    "expect",
    "spyOn",
]

這篇關(guān)于JSHint 認為 Jasmine 函數(shù)未定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準(zhǔn)備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發(fā)技術(shù)
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈?zhǔn)椒椒ㄟM行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監(jiān)視函數(shù)中的函數(shù)調(diào)用?)
主站蜘蛛池模板: 久久久久久久久91 | 精品国产99 | 日韩一区二区精品 | 91成人午夜性a一级毛片 | 毛片在线免费 | 国产精品美女一区二区 | 欧美日日 | 欧美成人精品在线 | 一区二区三区不卡视频 | 国产99久久精品一区二区永久免费 | 亚洲精品国产a久久久久久 午夜影院网站 | 一级视频在线免费观看 | 亚洲成av人片在线观看 | 亚洲男人的天堂网站 | 欧美国产日韩一区 | 成人av网页| 91.com视频| 一区二区三区日韩 | 久久午夜剧场 | 国产在线精品一区二区 | 久久一区二区三区四区 | 一级在线视频 | 亚洲视频欧美视频 | 亚洲午夜av久久乱码 | 日韩亚洲视频在线 | 国产精品久久9 | 天天躁人人躁人人躁狂躁 | 操皮视频 | 日日夜夜免费精品 | 久久高清 | 国产午夜精品视频 | 欧美日韩中文字幕 | 少妇一级淫片免费播放 | 综合网伊人| 99re在线| www.天堂av.com | 国产精品夜色一区二区三区 | 久草网址| 国产欧美精品 | 精品视频久久久久久 | 二区亚洲|