如何在 node.js intellisense 中启用 Jasmine 支持

How to enable Jasmine support in node.js intellisense

我已经在我的项目中安装了 jasmine。现在,当我在 *.spec.js 中写入以下内容时:

describe(...)

我收到警告:

Unresolved function or method describe

我在 this answer 中读到我可以将 jasmine 添加为一个库,我认为这应该可以解决它。

但它似乎不起作用 - 警告仍然存在。我错过了什么?

问题出在 Jasmine 中的 the way globals are defined:

  // returns object with `describe`, `it`... properties
  var jasmineInterface = jasmineRequire.interface(jasmine, env);

  extend(global, jasmineInterface);

如果以这种方式定义全局变量,WebStorm 将无法获取它们。它似乎只能处理像顶级函数这样的简单情况:

function describe() {}

仍然可以通过下载并安装 DefinitelyTyped 包来获得智能感知支持: