gpt4 book ai didi

node.js - 告诉 Mocha 在哪里寻找测试文件

转载 作者:IT老高 更新时间:2023-10-28 23:23:28 25 4
gpt4 key购买 nike

我如何告诉 Mocha 在哪里寻找我的测试文件?我的测试文件不驻留在标准项目根 ./test 文件夹中。我的测试位于 Modules/.*/Tests/.

我尝试使用 --grep 命令行参数,但我感觉这个参数寻找的是测试名称而不是测试文件名称。

mocha --grep Modules\/.*\/Tests

上面的命令报错:

Warning: Could not find any test files matching pattern: test
No test files found

最佳答案

你不仅要匹配目录,还要匹配它的文件。此外,不需要 grep ,只使用 -- :

mocha -- Modules/**/Tests/*.js
// or `mocha -- Modules/Tests/*.js` (I am not sure because you didn't give the project hierarchy )

关于node.js - 告诉 Mocha 在哪里寻找测试文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42335676/

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