Jasmine (software)
Jasmine is an open-source testing framework for JavaScript.[src] It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax.[src] It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.[src]
Jasmine is an open-source testing framework for JavaScript.[src] It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax.[src] It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.[src] ==History== The developers at Pivotal Labs for Jasmine previously developed a similar unit testing framework called JsUnit before active development of Jasmine.[src] function helloWorld() { return 'Hello world!'; } and verifies that its output is indeed the text "Hello world!".[src] describe('Hello world', function() { it('says hello', function() { expect(helloWorld()).toEqual('Hello world!'); }); }); Jasmine provides a rich set of built-in matchers.[src] In the above example, toEqual checks the equality between the value returned from the helloWorld() function and the 'Hello world!' string.[src] This is the same as assertions used in other testing frameworks.[src] Jasmine matchers return a Boolean value: true if the expectation is matched (a way to indicate that the test has passed) or false if the expectation does not match.[src] A good practice is to put a single expectation in an individual it() test specification.[src] Other built-in matchers include toBe, toBeTruthy, toBeFalsy, toContain, toBeDefined, toBeUndefined, toBeNull, toBeNaN, toBeGreaterThan, toBeLessThan, toBeCloseTo.[src] The identity matcher toBe checks if two things are the same object.[src] The condition matchers toBeTruthy, toBeFalsy evaluate if something is true or false and toBeDefined, toBeUndefined check if something is defined or undefined.[src] As the name suggests toBeNull checks if something is null and toBeNaN checks if something is not a number (NaN).[src] Precision matcher toBeCloseTo accepts two parameters and checks if a number is close to the first parameter, given a certain amount of decimal precision as indicated by the second parameter.[src] Matcher toContain is used to verify that an element, object or sub-string is contained in an array, list or string.[src] The special built-in matcher toThrow is used to verify that an exception has been thrown.[src] The code below verifies that "Some exception" is thrown.[src] describe('Expect to throw an exception', function() { it('throws some exception', function() { expect( function(){ throw('Some exception'); }).toThrow('Some exception'); }); }); Jasmine has a number of other features, such as custom matchers, spies, and support for asynchronous specifications.[src]
22 sentences · 22 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Jasmine (software)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/jasmine-software. Accessed 26 November 2026.
Chicago
"Jasmine (software)." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/jasmine-software.
APA
encyclopegia.org. (2025). Jasmine (software). Retrieved November 26, 2026, from https://encyclopegia.org/wiki/jasmine-software
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON