Yes, you can run a subset of tests.
Use iit
instead of it
on the tests you would like to run and the others will be skipped.
Example:
describe('TestCtrl', function() {
var $scope;
iit('should have scope', function() {
expect($scope).toBeDefined();
});
it('should have scope', function() {
expect($scope).toBeDefined();
});
it('should have scope', function() {
expect($scope).toBeDefined();
});
});
This will cause only the first test to be run and the others to be skipped.
As soon as Jasmine detects a test with iit
, it will skip the all tests with it
.
This is very handy if you need to test only one or two tests you are working on when you have defined a whole suite of tests.
This also works when you replace describe
with ddescribe
to run only blocks with ddescribe
.
As soon as you remove all iit
and ddescribe
calls, all tests will be run again.
Hope that helps!