告诉Mocha在哪里寻找测试文件

saz*_*azr 9 mocha.js node.js

我怎么知道Mocha在哪里查找我的测试文件?我的测试文件不在标准项目根./test文件夹中.我的考试坐了下来Modules/.*/Tests/.

我试图使用--grep命令行参数但我觉得这个参数寻找测试名称而不是测试文件名称.

摩卡 - 格雷普 Modules\/.*\/Tests

上面的命令给出了错误:

警告:找不到与模式匹配的任何测试文件:test未找到
测试文件

Abd*_*UMI 19

您不仅要匹配目录,还要匹配其文件.此外,不需要grep,仅使用--:

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