如何递归地告诉摩卡在哪里找到我的测试?
How to tell mocha where to find my tests recursively?
我有以下文件夹结构:
- 应用
- 拉姆达
- 用户
- handler.js
- 公司
- handler.js
- 测试
- mocha.opts
- package.lock.json
- package.json
- 拉姆达
- 用户
- handler.test.js
- helper.js
- 公司
- handler.test.js
- fixture.js
当我从以下位置 运行 'npm test'
C:\myproject\tests> npm 测试
我收到以下警告,因为它找不到要 运行 的测试。
警告:找不到任何匹配模式的测试文件:test
未找到测试文件
错误!测试失败。详情见上文。
我如何配置它以告诉 Mocha 仅 运行 我所有的 'handler.test.js' 文件?
我有这个 package.json
"scripts": {
"test": "mocha './lambda/**/*.test.js'"}
我希望它能工作,但找不到测试文件。
How can I configure it to tell Mocha to run only all my
'handler.test.js' files?
试试这个:
"scripts": {
"test": "mocha tests/lambda/**/*.test.js --recursive"
}
我有以下文件夹结构:
- 应用
- 拉姆达
- 用户
- handler.js
- 公司
- handler.js
- 用户
- 拉姆达
- 测试
- mocha.opts
- package.lock.json
- package.json
- 拉姆达
- 用户
- handler.test.js
- helper.js
- 公司
- handler.test.js
- fixture.js
- 用户
当我从以下位置 运行 'npm test'
C:\myproject\tests> npm 测试
我收到以下警告,因为它找不到要 运行 的测试。
警告:找不到任何匹配模式的测试文件:test
未找到测试文件
错误!测试失败。详情见上文。
我如何配置它以告诉 Mocha 仅 运行 我所有的 'handler.test.js' 文件?
我有这个 package.json
"scripts": {
"test": "mocha './lambda/**/*.test.js'"}
我希望它能工作,但找不到测试文件。
How can I configure it to tell Mocha to run only all my 'handler.test.js' files?
试试这个:
"scripts": {
"test": "mocha tests/lambda/**/*.test.js --recursive"
}