@motorman/conductor

0.0.3 • Public • Published

Motorman Conductor

tl;dr

As of now, the tests (./test.js) and the source are the best documentation. That said, it ain't Rocket Surgery, but it will keep you from pulling cats & herding teeth to configure a test-runner with some hooks so you can cross your I's and dot your T's on your next project. This is just a simple wrapper around Mocha.

About

Uses globby for file patterns.

Installation

npm i @motorman/conductor -D

Usage

    var { Conductor } = require('@motoman/conductor');

    var config = {  // see Mocha docs for configs
        root: './src',
        inclusions: '*/**/*.spec.js',  // see @About #globby
    };
    var conductor = new Conductor(config);

    conductor
        .subscribe( Conductor.events[x], () => {} )  // see Mocha docs for events
        .subscribe( Conductor.events[y], () => {} )
        .subscribe( Conductor.events[z], () => {} )
        ;
    conductor.files
        .then( (files) => conductor.drive() )  // <-- returns new promise resolution chain
        .then( (runner) => runner.addListener( Conductor.events[x], () => {} ) )
        ;

Interface

    expect(conductor.files).to.ok;
    expect(conductor.subscribe).to.ok;
    expect(conductor.drive).to.ok;
    expect(conductor.files).to.be.an.instanceof(Promise);
    assert.isFunction(conductor.subscribe);
    assert.isFunction(conductor.drive);

Configuration

See @Usage & MochaJS docs.

.root: string

Where Conductor should start its search for .inclusions. The .root serves as the prependix to all patterns of inclusions.

.inclusions: string | string[]

Files to include. May be a glob string or an array of glob strings. See globby for more info.

[EVERYTHING ELSE]

See MochaJS configurations.

API

.files: Promise<string>

The .files property is a Promise which encapsulates an array of paths to files which were found by .config.inclusions.

.subscribe(channel: string, handler: (...splat) => {}): Conductor

.drive(): Promise<MochajsRunner>

ToDo

  • @About
  • @Configuration docs
  • @API docs
  • .npmignore?

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    3
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i @motorman/conductor

Weekly Downloads

5

Version

0.0.3

License

MIT

Unpacked Size

11.2 kB

Total Files

10

Last publish

Collaborators

  • codyscarlson