JavaScripttestframework:Mocha
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. Hosted on GitHub.
https://mochajs.org/#reporters
INSTALLATION
Install with npm globally:
$ npm install --global mocha
or as a development dependency for your project:
$ npm install --save-dev mocha
Mocha currently requires Node.js v6.x or newer.
GETTING STARTED
$ npm install mocha
$ mkdir test
$ $EDITOR test/test.js # or open with your favorite editor
In your editor:
var assert = require(`assert`);
describe(`Array`, function() {
describe(`#indexOf()`, function() {
it(`should return -1 when the value is not present`, function() {
assert.equal([1,2,3].indexOf(4), -1);
});
});
});
相關文章
- Mocha
- 單元測試 -- mocha + chaiAI
- [譯] 快速,完整的 Mocha 測試指南
- Mocha瀏覽器測試入門教程瀏覽器
- javascript單元測試框架mocha 和 斷言庫 assertJavaScript框架
- MochaImport+ for Mac - 匯入處理Mocha跟蹤資料AIImportMac
- 達芬奇/Fusion/Nuke/OFX外掛:Mocha Pro 2019 Plugins OFX for macPluginMac
- 【vue系列】vue2.0 專案配置 Mocha 單元測試Vue
- 【轉】Webpack 中配置的 alias 在 Mocha 測試用例中Web
- 入門:前端自動化測試karma,Backstopjs,Selenium-webdriver,Mocha前端JSWeb
- M1可用 視訊後期渲染效果Mocha Pro 2022 PluginsPlugin
- 搭建 vue2 單元測試環境(karma+mocha+webpack3)VueWeb
- [譯] JavaScript 單元測試框架:Jasmine, Mocha, AVA, Tape 和 Jest 的比較JavaScript框架ASM
- Boris FX Mocha Pro 2023 for Mac(AE/達芬奇/Fusion/Nuke/OFX外掛)啟用版Mac
- 一步一步搭建react應用-node中使用 mocha + supertest + should 來寫單元測試React
- 大前端的自動化工廠(5)—— 基於Karma+Mocha+Chai的單元測試和介面測試前端AI