🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mochasteps

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mochasteps

Steps helper for Mocha

0.1.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

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.

Keywords

mocha

FAQs

Package last updated on 19 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts