0.0.7 • Published 6 years ago

mocha-pipe v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

mocha-pipe

Build a test pipeline with mocha

Build Status Coverage Status NPM version Downloads David devDependencies Status GitHub issues license GitHub stars Built with love Powered by mocha

Gittip

NPM

mocha-pipe

mocha-pipe allows you to define your tests as a series of asynchronous units of work. Collectively the individual steps make up the pipeline. Each step pipes its output into the next step. If any uncaught exception occurs, the pipe is considered broken, and the step which threw the error will show as broken. The pipe returns a promise which will be resolved with the result from the last step.

Install

npm install --save-dev mocha-pipe
# or
yarn add -D mocha-pipe

Basic Example

const mochaPipe = require('mocha-pipe');

const steps = [{
    name: 'Get user', // passed to it(name, ...);
    before: () => 'MOCHA_PIPE',
    execute: (username) => getUser(username),
    after: res => assertSomething(res)
}, {
    name: 'Update user email',
    execute: user => updateEmail(user, 'a@b.com'),
    after: res => assertSomething(res)
}, {
    name: 'Expect 401 on invalid password',
    execute: user => authenticate(user, 'bad password').catch(err => assertStatusCode(err, '401')) 
}];

const pipeline = mochaPipe({
    name: 'Basic Example', // passed to describe(name, ...);
    steps
});

pipeline.run();
0.0.7

6 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago