gpt4 book ai didi

testing - 在 Webstorm 中运行 Mocha 测试

转载 作者:行者123 更新时间:2023-11-28 19:57:56 24 4
gpt4 key购买 nike

我正在使用以下 NPM 启动命令在 Webstorm 的终端窗口中为 React 运行 Mocha 测试:

"tsc && mocha --compilers js:babel-core/register --require ./test_helper.js \"test/**/*.@(js|jsx)\" --watch --watch-extensions js,jsx,tsx"

如何创建 Webstorm Mocha 配置以便我可以在 Webstorm 的测试窗口中运行测试?

谢谢。

最佳答案

为 Mocha 添加配置:

运行 -> 编辑配置 -> 按“+” -> 选择“Mocha”。

表单字段:

节点解释器: your_node_executable_path

工作目录: root_path_of_your_app

Mocha 包: mocha_path(通常在您的 node_modules 文件夹中)。

测试目录: root_path_of_your_app \test

默认情况下,Mocha 在 test 文件夹中查找测试,并尝试运行 test.js

所有 Mocha 命令(--compilers--require 等)都可以包含在 mocha.opts 中。 Mocha 尝试读取 \test\mocha.opts 中的这个文件。

mocha.opts 每行需要一个命令。

关于testing - 在 Webstorm 中运行 Mocha 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35979110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com