Socket
Socket
Sign inDemoInstall

mocha-steps

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-steps

Sequential scenarios for Mocha


Version published
Maintainers
1
Created
Source

mocha-steps

Sequential scenarios for Mocha

Global 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.

Setup

NPM

Then simply run mocha with --require mocha-steps.

Example

describe('my smoke test', function() {

  step('login', function() {
  });

  step('buy an item', function() {
    throw new Error('failed');
  });

  step('check my balance', function() {
  });
  
  xstep('temporarily ignored', function() {
  });

});
  • With the standard it()
my smoke test
   ✓ login
   ✗ buy an item
   ✓ check my balance
  • Using step()
my smoke test
   ✓ login
   ✗ buy an item

Notes

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

Keywords

FAQs

Package last updated on 22 May 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc