mochasteps

0.1.2 • Public • Published

steps

Steps helper for Mocha

step() function, as a drop-in replacement for it(). Any failing step will abort the all describe immediately. This is handy for BDD-like scenarios, or smoke tests that need to run through specific steps.

Setup

Then simply run mocha with --require steps.

Example

describe('my smoke test', function() {
 
  step('open page', function() {});
 
  step('select item', function() {
    throw new Error('failed');
  });
 
  step('buy item', function() {});
  
  xstep('ignored step', function() {});
 
});
  • With the standard it()
my smoke test
   ✓ open page
   ✗ select item
   ✓ buy item
  • Using step()
my smoke test
   ✓ open page
   ✗ select item
   - buy item (abort all suites)

Notes

  • Unlike Mocha's --bail option, the rest of the test suite will run normally.
  • step() works with both synchronous and async tests.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.20latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i mochasteps

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • some-say