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
Weir constructor.
Create a new Weir.
Return:
{object}
Extend Weir.prototype.
Parameters:
{object} ext
Return:
{object}
Merge result.
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} done
Callback fired after run finishes{function} itWrap
it()
wrapper from which context can be shared{function} describeWrap
describe()
wrapper from which context can be shared{object} omitContextRegex
Property 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} path
Names of ancestor describe levels to the currently executingit()
{regexp} grep
Filterit()
execution bycurrent path + it() name
{regexp} grepv
Omitit()
execution bycurrent path + it() name
{object} sharedContext
Sharedthis
updated after each hook/describe/it execution{object} stats
{number} depth
Current stack depth during test run
Properties:
{array} rootDescribe
Top-levelDescribe
objects{object} batch
Batch
instance used to run collected test steps{object} seedProps
Merged into initial hook/describe/it context
Inherits:
emitter
component
See:
Go: TOC
Add a property to the initial hook/describe/it shared context.
Parameters:
{string} key
{mixed} val
Return:
{object}
this
Go: TOC | Weir.prototype
Add a top-level
describe()
.
Parameters:
{string} name
{function} cb
Return:
{object}
this
Go: TOC | Weir.prototype
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
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
Run collected
describe()
steps.
See:
Go: TOC | Weir.prototype
Add an
it()
step.
Parameters:
{string} name
{function} cb
Batch#push
compatible
See:
Go: TOC | Describe.prototype
Add a
describe()
step.
Parameters:
{string} name
{function} cb
Batch#push
compatible
See:
Go: TOC | Describe.prototype
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
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
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
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—