Jest (JavaScript framework)

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Jest" JavaScript framework – news · newspapers · books · scholar · JSTOR (March 2019) (Learn how and when to remove this template message)

|

Jest[1] is a JavaScript testing framework built on top of Jasmine[2] and maintained by Meta (formerly Facebook). It was designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Node.js, React, Angular, Vue.js and Svelte. Jest doesn't require a lot of configuration for first-time users of a testing framework.

## Contents

* 1 Usage and examples
* 1.1 Installation
* 1.2 Example
* 2 See also
* 3 References
* 4 External links

## Usage and examples

### Installation

Use the JavaScript package manager npm to install Jest in Node.js:

$ npm install --save-dev jest

### Example

In this example, we will write a test case for the following module saved as `sum.js`:

function sum(a, b) {
return a + b;

module.exports = sum;

Our test case will be in a file named `sum.test.js` for Jest to automatically pick it up as a test case for `sum.js`.

The contents of the file with the test case will be:

const sum = require('./sum');

test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});

Then, from the command line, we run this command:

$ npm run test

This runs the test and outputs the corresponding result on the command line.

## See also

* List of unit testing frameworks
* Jasmine
* Mocha
* npm
* QUnit
* Unit.js
* JavaScript framework
* JavaScript library

## References

1. ↑ "Jest Website". https://jestjs.io/.
2. ↑ "jest/README.md at 88a94d5d1bc1f387317a3068bf510ab992c5dc64 · facebook/jest" (in en). https://github.com/facebook/jest/blob/88a94d5d1bc1f387317a3068bf510ab992c5dc64/README.md.

## External links

* GitHub repository
* Jest documentation

* v
* t
* e

JavaScript

Code analysis|

* ESLint
* JSHint
* JSLint

Transcompilers|

* Babel.js
* CoffeeScript
* LiveScript
* Dart
* Emscripten
* Google Closure Compiler
* Google Web Toolkit
* Morfik
* TypeScript
* AtScript
* Opa
* Nim
* Haxe
* ClojureScript
* WebSharper
* PureScript
* Reason
* Elm

Concepts|

* Client-side
* JavaScript library
* JavaScript syntax
* Unobtrusive JavaScript

Debuggers|

* Firebug
* Komodo IDE
* Microsoft Script Debugger
* Microsoft Script Editor
* Opera Dragonfly
* Web Inspector

Doc generators|

* JSDoc

Editors (comparison)|

* Ace
* Cloud9 IDE
* Atom
* CodeMirror
* Light Table
* Brackets
* Koding
* PhpStorm
* Orion
* Visual Studio
* Visual Studio Express
* Visual Studio Code
* Visual Studio Team Services

Engines|

* Comparison of engines
* DOM support
* List of ECMAScript engines

Frameworks|

* Comparison of JavaScript frameworks
* List of JavaScript libraries

Related technologies|

* Cascading Style Sheets
* Document Object Model
* HTML
* Dynamic HTML
* Ajax
* JSON
* WebAssembly
* asm.js

Package managers|

* npm

Application Bundlers|

* Webpack

Server-side|

* Active Server Pages
* CommonJS
* JSGI
* Node.js
* Wakanda

Unit testing|

* Jasmine
* Mocha
* QUnit
* List of JavaScript unit testing frameworks
* Jest

People|

* Douglas Crockford
* Brendan Eich
* John Resig

0.00

(0 votes)

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Jest_(JavaScript_framework)&oldid=744914"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template