Whisher
Whisher

Reputation: 32776

Angular Run a single/group Unit Test

How to run a single test or a group of tests?

I've tried in src/test.ts with (for a single test)

(My home component is in app/pages/home)

const context = require.context('./', true, /\home\.spec\.ts$/);

but it doesn't work

I mean the browser is run

but I've got

0 specs, 0 failures

Upvotes: 0

Views: 831

Answers (1)

user4676340
user4676340

Reputation:

Your tests are made of a describe and one or several it like so

describe('MyComponent', () => {
  it('should ...', done => {

  });
});

If you want to force a group, use fdescribe, and a test, use fit

fdescribe('Forcing MyComponent', () => {
  it('should ...', done => {

  });
});

describe('MyComponent', () => {
  fit('forced should ...', done => {

  });
});

Upvotes: 1

Related Questions