bdd-with-opts

1.1.1 • Public • Published

mocha-bdd-with-opts

Alternate BDD for Mocha with options in the parameter list. For the moment it only supports the pending option, used to skip tests.

NPM version Downloads Dependency Status devDependency Status

Usage

Basics:

 
"use strict";
var assert = require('assert');
 
/* global describe, it */
describe('bdd-with-opts', function(){
  var testCount = 0;
 
  it('should be skiped', {pending: true}, function(){
    testCount ++;
    assert(false);
  });
 
  it('should not be skiped', function(){
    testCount ++;
    assert(true);
  });
 
  it('should have run 1 test' ,function(){
    assert(testCount === 1);
  });
 
});
 

With a skip function:

"use strict";
/* global describe, it */
 
var assert = require('assert');
 
var ENV = {
    BROWSER: 'firefox'
};
 
function skipIfBrowserIs(browserToSkip) {
    var ret = {
        pending: ENV.BROWSER === browserToSkip
    };
    console.log('ret -->', ret);
    return ret;
}
 
describe('bdd-with-opts', function(){
  var testCount = 0; 
 
  it('should be skiped', skipIfBrowserIs('firefox'), function(){
    testCount ++;
    assert(false);
  });
 
  it('should not be skiped', skipIfBrowserIs('chrome') ,function(){
    testCount ++;
    assert(true);
  });
 
  it('should have run 1 test' ,function(){
    assert(testCount === 1);
  });
 
});
 

/bdd-with-opts/

    Package Sidebar

    Install

    npm i bdd-with-opts

    Weekly Downloads

    8

    Version

    1.1.1

    License

    MIT

    Last publish

    Collaborators

    • sebv