Installing the Karma CLI

To install the Karma CLI, enter the following command:

npm install -g karma-cli

Our test will be executed in a .spec.ts file. Create a new test file (sampletest.spec.ts) in the ./app/ folder and copy the following:

// ./app/sampletest.spec.tsdescribe('Sample Test', () => { it('true is true', () => expect(true).toBe(true)); });  import {AppComponent} from './app.component';  describe('AppComponent', () => { beforeEach(function() { = new AppComponent(); });  it('should have hello property', function() { expect('Hello, World!'); }); });

In the preceding code, we first write a sample test to showcase the main concepts in Jamine. We create a test suite, define our test suite, and write the ...

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

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