Sequential scenarios for Mocha
step() function, as a drop-in replacement for
it(). Any failing
step will abort the parent
describe immediately. This is handy for BDD-like scenarios, or smoke tests that need to run through specific steps.
npm install mocha-steps --save-dev
Then simply run mocha with
- With the standard it()
my smoke test ✓ login ✗ buy an item ✓ check my balance - temporarily ignored
- Using step()
my smoke test ✓ login ✗ buy an item - check my balance - temporarily ignored
- Unlike Mocha's
--bailoption, the rest of the test suite will run normally.
step()works with synchronous, async, event-based and promise tests.
When submitting a PR, please run
./test.sh and implement new test cases if required.