为 VSCode 中的 node.js 应用程序调试 vanilla jasmine

Debugging vanilla jasmine for a node.js application in VSCode

我正在尝试使用 Visual Studio 代码 运行 Node.JS API 上的 Jasmine 规范。但是,当我在调试(使用 F5)下 运行 时,除了控制台输出在某种程度上告诉我它 运行s 之外,我没有得到任何输出。如果我使用 ctrl+F5,它 运行 是规格,但我当然不能闯入它。

我最初安装 jasmine-node, which did work fine with some tweaking with VSCode, allowing me to run and debug tests. However, for reasons of standardization across the team, etc, etc, our other Jasmine specs in other projects are using Jasmine 2. Jasmine-Node only supports Jasmine 1, with experimental beta support for 2 on a separate branch. So I installed vanilla Jasmine as it says here 它应该 运行 适合 NodeJS。

我在 CLI 上 运行 jasmine init 并获得了一个配置文件和所有这些好东西。现在,当我从命令行使用 jasmine 时,规格全部 运行。同样,我将它连接到 npm test,当我 运行 时,所有规格再次 运行。

然后我想调整启动文件以确保我们可以调试我们的单元测试,那是我 运行 遇到麻烦的时候。

这是我的 launch.json:

{ "type": "node", "request": "launch", "name": "Run Jasmine tests", "stopOnEntry": false, "cwd": "${workspaceRoot}/api/content", "program": "${workspaceRoot}/api/content/node_modules/jasmine/bin/jasmine.js" }

我正在使用 VSCode 1.14.2,Jasmine 和 Jasmine-Core 2.7。

我需要做什么才能进行调试以使用 Jasmine 进行 运行ning 测试?回到 Jasmine-Node 是最好的方法吗?或者有没有办法用香草茉莉花做到这一点?

迁移到 jasmine 2.8 似乎解决了这个问题。我也转移到 jasmine-node 2.0.0,但我正在测试它,我认为它现在是多余的。所以我们可能刚刚遇到了这个项目中的一个错误。