exports.Weir()
May 13, 2013 · View on GitHub
Library for creating BDD-style test flows for JavaScript
Source: lib/weir/index.js
- exports.Weir
- exports.create
- exports.extend
- Weir
- Weir.prototype.addContextProp
- Weir.prototype.addRootDescribe
- Weir.prototype.currentDepth
- Weir.prototype.hideContextProp
- Weir.prototype.run
- Describe.prototype.it
- Describe.prototype.describe
- Describe.prototype.before
- Describe.prototype.beforeEach
- Describe.prototype.after
- Describe.prototype.afterEach
exports.Weir()
Weir constructor.
exports.create()
Create a new Weir.
Return:
{object}
exports.extend(ext)
Extend Weir.prototype.
Parameters:
{object} ext
Return:
{object} Merge result.
Weir()
Weir constructor.
Usage:
var flow = require('weir').create();
flow
.addRootDescribe('subject', function() {
this.it('should do X', function() {
// ...
});
})
.addContextProp('someKey', someVal)
.set('done', function() {
console.log('Run finished.');
})
.run();
Configuration:
{function} doneCallback fired after run finishes{function} itWrapit()wrapper from which context can be shared{function} describeWrapdescribe()wrapper from which context can be shared{object} omitContextRegexProperty name patterns- Ex. used to omit properties from propagating between
it()handlers - Indexed by type:
all,describe,hook,it,rootDescribe - Values are arrays of
RegExp.
- Ex. used to omit properties from propagating between
{array} pathNames of ancestor describe levels to the currently executingit(){regexp} grepFilterit()execution bycurrent path + it() name{regexp} grepvOmitit()execution bycurrent path + it() name{object} sharedContextSharedthisupdated after each hook/describe/it execution{object} stats{number} depthCurrent stack depth during test run
Properties:
{array} rootDescribeTop-levelDescribeobjects{object} batchBatchinstance used to run collected test steps{object} seedPropsMerged into initial hook/describe/it context
Inherits:
emittercomponent
See:
Go: TOC
Weir.prototype.addContextProp(key, val)
Add a property to the initial hook/describe/it shared context.
Parameters:
{string} key{mixed} val
Return:
{object} this
Go: TOC | Weir.prototype
Weir.prototype.addRootDescribe(name, cb)
Add a top-level
describe().
Parameters:
{string} name{function} cb
Return:
{object} this
Go: TOC | Weir.prototype
Weir.prototype.currentDepth()
Get the current stack depth.
Return:
{number}
0= every rootdescribe()- Each deeper
describe()is 1 more than its parentdescribe(). - Each
it()is 1 more than its parentdescribe().
Go: TOC | Weir.prototype
Weir.prototype.hideContextProp(type, regex)
Prevent a type of flow function from 'inheriting' specific context properties from enclosing/subsequently-executed flow functions.
Parameters:
{string} type'it', 'hook'{regexp} regex
Return:
{object} this
Go: TOC | Weir.prototype
Weir.prototype.run()
Run collected
describe()steps.
See:
Go: TOC | Weir.prototype
Describe.prototype.it(name, cb)
Add an
it()step.
Parameters:
{string} name{function} cbBatch#pushcompatible
See:
Go: TOC | Describe.prototype
Describe.prototype.describe(name, cb)
Add a
describe()step.
Parameters:
{string} name{function} cbBatch#pushcompatible
See:
Go: TOC | Describe.prototype
Describe.prototype.before(cb)
Run a custom hook before the first
it()in the currentdescribe().
Parameters:
{function} cb- Async-mode is optional and auto-detected:
function(done) { ... done(); }
- Async-mode is optional and auto-detected:
Go: TOC | Describe.prototype
Describe.prototype.beforeEach(cb)
Run a custom hook before each
it()in the currentdescribe().
Parameters:
{function} cb- Async-mode is optional and auto-detected:
function(done) { ... done(); }
- Async-mode is optional and auto-detected:
Go: TOC | Describe.prototype
Describe.prototype.after(cb)
Run a custom hook after the last
it()in the currentdescribe().
Parameters:
{function} cb- Async-mode is optional and auto-detected:
function(done) { ... done(); }
- Async-mode is optional and auto-detected:
Go: TOC | Describe.prototype
Describe.prototype.afterEach(cb)
Run a custom hook after each
it()in the currentdescribe().
Parameters:
{function} cb- Async-mode is optional and auto-detected:
function(done) { ... done(); }
- Async-mode is optional and auto-detected:
Go: TOC | Describe.prototype
—generated by apidox—