HOME

TheInfoList



OR:

Mocha is a
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
test framework for
Node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript code o ...
programs, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library.


Assertion Libraries

Mocha can be used with most JavaScript assertion libraries, including: * should.js * express.js * chai * better-assert * unexpected


Usage and examples

$ npm install -g mocha $ mkdir test $ $EDITOR test/test.js # or open with your favorite editor var assert = require("assert") describe('Foo', function()) $ mocha . 1 test complete (1ms)
For asynchronous testing, invoke the callback, and Mocha will wait for completion. describe('Foo', function())


See also

* Jasmine *
List of unit testing frameworks This article is a list of tables of code-driven unit testing frameworks for various programming languages. Some, but not all, of these are based on xUnit. Columns (classification) * Name: This column contains the name of the framework and w ...
* npm *
QUnit QUnit is a JavaScript unit testing framework. Originally developed for testing jQuery, jQuery UI and jQuery Mobile, it is a generic framework for testing any JavaScript code. It supports client-side environments in web browsers, and server-s ...
* Unit.js *
Jest A joke is a display of humour in which words are used within a specific and well-defined narrative structure to make people laugh and is usually not meant to be interpreted literally. It usually takes the form of a story, often with dialogue, ...
*
JavaScript framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
*
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. Libraries With the expanded demands for JavaScript, an ea ...


References


External links

* {{JavaScript JavaScript libraries JavaScript programming tools Software using the MIT license 2011 software