README
jasmine_stop-on-blocker
This project was originally designed for a personal use. Today it is open to everyone.
So if you think you have any improvements or features to add, I would be more than happy to add you as a collaborator.
Installation
npm i jasmine_stop-on-blocker
Description
jasmine-stop-on-blocker
is a small and simple custom reporter for jasmine framework.
Designed for handling jasmine runs to stop 'suites' if an important spec has failed.
A lot of times we find our self running a suites that has an important spec that all is
sibling specs depend on him (a blocker spec by definition). and if this blocker spec
will fail we don't have any reason to go on.
Or If we noticed that there are too many failures in one test, which means that it may
be a connection problem (for example) and not necessarily a problem in our app.
Clarification note:
Injasmine
's configuration there is the ability offailFast
(stopSpecOnFailure
in older versions) that what it dose is to stop suites if one spec has been fail. But there is a limitation with this option, Because sometimes we do want the suites
to continue even when one (or more) specs has been failed, But if there is a blocker' spec and other specs are depend on it, Then, like a said, I don't see any reason to go on (most of times any way).
Usage
In your jasmine helper file
Create one if you don't have one yet (Make sure jasmine.json file pointed to it).
javaScript
const jasmineStopOnBlocker = require('Jasmine_stop-on-blocker').default;
jasmine.getEnv().addReporter(new Jasmine_StopOnBlockerSpecFailure({
// If set to true, a failure blocker spec will not stop your test.
disable: false,
stopOnBlockerFailure: true,
amountOfDesiredFailureBeforeStop: 5
}))
typeScript
import jasmineStopOnBlocker from 'Jasmine_stop-on-blocker';
jasmine.getEnv().addReporter(new jasmineStopOnBlocker({
// If set to true, a failure blocker spec will not stop your test.
disable: false,
stopOnBlockerFailure: true,
amountOfDesiredFailureBeforeStop: 5
}));
Example
In Your spec
describe('Jasmine - stop on blocker specs', () => {
// If `jasmine_stop-on-blocker` defined to stop when blocker spec fails
it('This is a blocker spec. and mark as @blocker', () => {
expect(false).toBeTrue();
});
// If `jasmine_stop-on-blocker` defined to stop when number of fails in suites
// his reach to `amountOfDesiredFailureBeforeStop` configuration
it('Even without a blocker spec ', () => {
expect(true).toBeFalse();
});
// Pending
it('All other specs are on pending status', () => {});
// ...
});
Configuration
disable
whether to disablejasmine_stop-on-blocker
reporter. If set to true,
jasmine_stop-on-blocker
will not affect your run at all.stopOnBlockerFailure
Whether to stop on suites when a spec mark as a '@blocker' as failedamountOfDesiredFailureBeforeStop
Config how many times jasmine will keep running in case of a fail before stops. If the number of steps failed is greater than the desired number, then
jasmine_stop-on-blocker
will stop suite's run.
licence
This project is licensed under the terms of the MIT licence