如果我们有单元测试文件my-spec.js并使用mocha运行,我有以下问题:
mocha my-spec.js
Run Code Online (Sandbox Code Playgroud)
默认超时为2000 ms.可以使用命令行参数覆盖部分测试:
mocha my-spec.js --timeout 5000
Run Code Online (Sandbox Code Playgroud)
问题是:是否有可能全局更改所有测试的默认超时?即你打电话的时候
mocha my-spec.js
Run Code Online (Sandbox Code Playgroud)
默认超时值不同于2000毫秒提前感谢
var user = {
Name: "Some user",
Methods: {
ShowGreetings: function() {
// at this point i want to access variable "Name",
//i dont want to use user.Name
// **please suggest me how??**
},
GetUserName: function() { }
}
}
Run Code Online (Sandbox Code Playgroud)