Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to skip a unit test suite in Angular?

I have some unit test that should not be run, as of now, is there a way I can skip them? Other than using fdescribe on the ones I want to run.

like image 329
matchifang Avatar asked Sep 26 '18 09:09

matchifang


People also ask

Is Angular unit testing necessary?

Testing is absolutely necessary to ensure your Angular app is maintainable. Check out the documentation for testing Angular apps for more information.

How do I skip the test case in Jasmine?

Excluding Tests / Specs If you want to exclude a specific test, simply use xit() instead of it() . The x means exclude. describe('description', function () { xit('description', function () {}); }); If you want to exclude an entire describe block, use xdescribe() instead of describe() .

Do you need unit tests with TypeScript?

There are a lot of different types of automated software testing. If you're familiar with the test automation pyramid, then you know unit testing is the type of testing you should probably focus most of your efforts on. This is true regardless of programming language, and TypeScript is certainly no exception.

What is the best unit testing framework for Angular?

Jasmine is the default test framework used with Angular. It ships with Angular CLI by default. With such low friction required to use it, it's not surprising so many people adopt it.


1 Answers

If you're looking to skip tests, it's 'x' in front of describe() or it():

xdescribe('some test', () => { });

And maybe just skip a test in a block:

describe('some other test', () => {
  xit('skip this test', () => { });
});
like image 179
rrd Avatar answered Oct 17 '22 14:10

rrd