小编Sin*_*r M的帖子

使用 Node js Mocha 运行单个测试文件

我的所有测试都在测试文件夹下,当我给出所有测试时npm test,所有测试都会被执行。现在我尝试按文件或按描述运行我的测试脚本。我的 package.json 中有以下内容

"scripts": {
  "test": "set NODE_ENV=test&& nyc --reporter=html --reporter=text mocha 'test/**/*.js' --exit --timeout 7000"}
Run Code Online (Sandbox Code Playgroud)

当我给出npm test --grep 'filename / describe / it'它时,它没有获取给定的输入,而是收到以下警告Warning: Cannot find any files matching pattern "given filename / describe /it",即使给定的输入匹配。

我的文件名模式是filename.test.js,文件夹结构就像test\***\filename.test.js

谁能指导我我在这方面缺少什么。

unit-testing mocha.js node.js

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

mocha.js ×1

node.js ×1

unit-testing ×1