摩卡。测试几个 test.js
Mocha. Test several test.js
我有一些架构:
NameOfModule
|- module1
| |- file1.js
| |- file2.js
| |- test.js
|
|- module2
|- file1.js
|- file2.js
|- test.js
等等
我知道如何运行 test.js。我很简单,在终端中运行:
:~$ mocha
但我想从根目录 NameOfModule
运行所有 test.js 个文件。我怎样才能从终端做到这一点?这是什么命令?
我有 Lubuntu 14.10。
您可以给 mocha
您希望它加载的文件列表,使用 sh
或 bash
作为您的 shell:
$ mocha `find . -name test.js`
find
命令查找所有名为 test.js
的文件。反引号使得 find
的输出作为参数传递给 mocha
.
我有一些架构:
NameOfModule
|- module1
| |- file1.js
| |- file2.js
| |- test.js
|
|- module2
|- file1.js
|- file2.js
|- test.js
等等
我知道如何运行 test.js。我很简单,在终端中运行:
:~$ mocha
但我想从根目录 NameOfModule
运行所有 test.js 个文件。我怎样才能从终端做到这一点?这是什么命令?
我有 Lubuntu 14.10。
您可以给 mocha
您希望它加载的文件列表,使用 sh
或 bash
作为您的 shell:
$ mocha `find . -name test.js`
find
命令查找所有名为 test.js
的文件。反引号使得 find
的输出作为参数传递给 mocha
.