gpt4 book ai didi

javascript - Mocha JS : grep not matching any tests

转载 作者:行者123 更新时间:2023-11-29 21:02:36 25 4
gpt4 key购买 nike

出于某种原因,Mocha 似乎无法匹配任何模式。

mocha -g MyClass

显示 0 次通过(0 毫秒),如果我运行一个测试脚本,我实际上有几个可以运行并通过的测试。

mocha test/my/test.js

产生 4 次通过(10 毫秒)

test.js 中,我有

describe ('MyClass', function () {
describe ('someMethod()', function () {
it ('Should be...', function () {
....
})
...
})
})

知道我做错了什么吗?使用 mocha 3.5.0。

最佳答案

当您执行 mocha test/my/test.js 时,Mocha 可以毫不费力地找到测试,因为您提供了文件的完整路径。当你执行 mocha -g MyClass 时,Mocha 必须自己找到文件。它在 test 中查找,您的测试文件位于它下面。到目前为止一切顺利,但默认情况下 Mocha 不会进入 test 的子目录。所以你必须做 mocha -g MyClass --recursive

关于javascript - Mocha JS : grep not matching any tests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45765801/

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