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 - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

14

lib/step.js

@@ -12,3 +12,11 @@ global.step = function(msg, fn) {

try {
fn.call(context);
var promise = fn.call(context);
if (promise != null && promise.then != null && promise.catch != null) {
return promise.catch(function(err) {
context.test.parent._bail = true;
throw err;
});
} else {
return promise;
}
} catch (ex) {

@@ -53,3 +61,5 @@ context.test.parent._bail = true;

if (fn.length === 0) {
if (fn == null) {
it(msg);
} else if (fn.length === 0) {
it(msg, sync);

@@ -56,0 +66,0 @@ } else {

13

package.json
{
"name": "mocha-steps",
"version": "0.0.1",
"version": "1.0.0",
"description": "Sequential scenarios for Mocha",
"author": "Romain Prieto",
"keywords": ["mocha", "step", "test", "bdd", "scenarios", "sequence"],
"keywords": [
"mocha",
"step",
"test",
"bdd",
"scenarios",
"sequence"
],
"license": "MIT",

@@ -20,4 +27,4 @@ "main": "lib/step.js",

"devDependencies": {
"mocha": "~1.19.0"
"mocha": "^2.3.4"
}
}

@@ -54,2 +54,2 @@ # mocha-steps

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

@@ -98,4 +98,27 @@ var EventEmitter = require('events').EventEmitter;

it('is not executed');
});
describe('promise', function() {
it('step 1', function() {
return new Promise(function(resolve, reject) {
setTimeout(resolve, 50);
});
});
it('step 2', function() {
return new Promise(function(resolve, reject) {
setTimeout(reject, 50);
});
});
it('step 3', function() {
return new Promise(function(resolve, reject) {
setTimeout(resolve, 50);
});
});
});
});

@@ -100,4 +100,28 @@ var EventEmitter = require('events').EventEmitter;

step('is not executed');
});
describe('promise', function() {
step('step 1', function() {
return new Promise(function(resolve, reject) {
setTimeout(resolve, 50);
});
});
step('step 2', function() {
return new Promise(function(resolve, reject) {
setTimeout(reject, 50);
});
});
step('step 3', function() {
return new Promise(function(resolve, reject) {
setTimeout(resolve, 50);
});
});
});
});
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