簡體   English   中英

Intellij 的想法無法識別 mochajs 關鍵字,如“描述”、“之前”、“它”等

[英]Intellij idea not recognizing mochajs keywords like 'describe', beforeAll, it, etc

我只是在 Intellij Idea 中使用 mochajs 建立一個小型學習項目。 我可以成功運行一個簡單的測試,但 Intellij 的想法似乎無法識別關鍵字“describe”、“beforeAll”、“it”...等。 我怎樣才能解決這個問題?

在此處輸入圖片說明

{
  "name": "seleniumjs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "./node_modules/.bin/mocha --no-timeout ./tests/*.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {},
  "devDependencies": {
    "mocha": "^8.2.1",
    "selenium-webdriver": "^4.0.0-alpha.7"
  }
}

Mocha 不公開其全局變量,因此讓靜態代碼分析識別這些方法的唯一方法是安裝npm i @types/mocha ( npm i @types/mocha )。

請參閱https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

暫無
暫無

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

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