This package has been deprecated

Author message:

This package is no longer supported.

metamagical-mocha-bridge

0.4.0 • Public • Published

Meta:Magical Mocha Bridge

Chat on Gitter Build status NPM version Licence Stability: Stable

This package allows defining Mocha test cases from Meta:Magical examples.

Example

Annotate some object with Meta:Magical using the examples meta-data:

function double(n) {
  return n + n;
}
 
double[Symbol.for('@@meta:magical')] = {
  name: 'double',
  examples: [_ => {
    var assert = require('assert');
    assert(double(10) === 20);
    assert(double(15) === 30);
  }]
}

Then use this module inside a Mocha test:

const metamagical = require('metamagical-interface');
const defineTests = require('metamagical-mocha-bridge')(metamagical, describe, it);
 
defineTests(double);

NOTE
metamagical-mocha-bridge only runs tests for named objects.

If you use the Babel assertion comments plugin, you can write this instead:

function double(n) {
  return n + n;
}
 
double[Symbol.for('@@meta:magical')] = {
  name: 'double',
  examples: [_ => {
    double(10); // ==> 20
    double(15); // ==> 30
  }]
}

Installing

The only supported way to install the transform plugin is through npm.

NOTE
If you don't have npm yet, you'll need to install Node.js. All newer versions (4+) of Node come with npm.

$ npm install metamagical-mocha-bridge

Support

If you think you've found a bug in the project, or want to voice your frustration about using it (maybe the documentation isn't clear enough? Maybe it takes too much effort to use?), feel free to open a new issue in the Github issue tracker.

Pull Requests are welcome. By submitting a Pull Request you agree with releasing your code under the MIT licence.

You can join the Gitter Channel for quick support. You can contact the author over email, or Twitter.

Note that all interactions in this project are subject to Origami Tower's Code of Conduct.

Licence

Meta:Magical is copyright (c) Quildreen Motta 2016, and released under the MIT licence. See the LICENCE file in this repository for detailed information.

Readme

Keywords

Package Sidebar

Install

npm i metamagical-mocha-bridge

Weekly Downloads

0

Version

0.4.0

License

MIT

Last publish

Collaborators

  • robotlolita