Jasmine is a behavior-driven JavaScript testing framework. It has a very simple syntax, and can be extended easily. It is the recommended framework for Aurelia as well as Angular 2 unit and integration testing. Installation of Jasmine using npm is as follows:

npm install jasmine --save 

The relevant declaration files for Jasmine can be installed by using @types as follows:

npm install @types/jasmine --save

A simple Jasmine test

Jasmine uses a simple format for writing tests. Consider the following TypeScript code:

    describe("tests/01_SimpleJasmineTests.ts ", () => { 
      it("should fail", () => { 
        let undefinedValue; 

This snippet starts with a Jasmine function called describe, which takes two arguments. ...

Get Mastering TypeScript - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.