Javascript 模块是否将jest用作预期样式?
我是新来的Javascript 模块是否将jest用作预期样式?,javascript,node.js,typescript,jestjs,chai,Javascript,Node.js,Typescript,Jestjs,Chai,我是新来的jest,以前我用的是chai+mocha。我喜欢使用chai的expect风格是否有任何nodejs模块允许我编写类似柴式的jest? 而是expect(isOPDSAgent(ua)).toBeTruthy()我想要expect(isOPDSAgent(ua)).to.be.ok这将使切换旧的单元测试变得容易 我试着搜索,但找不到。感谢您的帮助 jest支持,您应该能够 package.json { // ... "devDependencies": { "jest
jest
,以前我用的是chai
+mocha
。我喜欢使用chai
的expect
风格是否有任何nodejs模块允许我编写类似柴式的jest
?
而是expect(isOPDSAgent(ua)).toBeTruthy()代码>我想要expect(isOPDSAgent(ua)).to.be.ok代码>这将使切换旧的单元测试变得容易
我试着搜索,但找不到。感谢您的帮助 jest支持,您应该能够
package.json
{
// ...
"devDependencies": {
"jest": // ...
"chai": // ...
},
"jest": {
"setupFiles": [
"<rootDir>/setupChai.js"
]
}
}
// this should overwrite the global expect provided by jest
global.expect = require('chai').expect
jest支持,您应该能够
package.json
{
// ...
"devDependencies": {
"jest": // ...
"chai": // ...
},
"jest": {
"setupFiles": [
"<rootDir>/setupChai.js"
]
}
}
// this should overwrite the global expect provided by jest
global.expect = require('chai').expect
我不是说用chai,只是stynx follow chai,我不是说用chai,只是stynx follow chaiI试图通过缩短瓷砖、纠正拼写错误和稍微润色语言来让你的问题更具可读性。希望能有帮助。我试图通过缩短平铺、纠正拼写错误和稍微润色语言来使你的问题更具可读性。希望能有帮助。