🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

mocha-plugin-highland

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-plugin-highland

Mocha plugin to enable Highland streams support

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

mocha-plugin-highland

Build Status Coverage Status

A mocha plugin to enable Highland stream (using highland) support.

Installation

  • npm install --save-dev mocha-plugin-highland
  • just add -r mocha-plugin-highland in your mocha command line npm script in package.json
{
  "scripts" : {
    "test": "node node_modules/mocha/bin/_mocha -r mocha-plugin-highland",
    "coverage": "node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- -r mocha-plugin-highland"
  }
}

Example Usage

require('should');
var fs = require('fs');
var _ = require('highland');

var readFile = _.wrapCallback(fs.readFile);

describe('sometest', function () {
  it('should read file and output a collection of names', () => 
    readFile('myfile.txt')
    .map(toUpperCase)
    .map(function (x) {
        return {name: x};
    })
    .collect()
    .tap(arr => {
        arr.should.containDeep([
            { name: 'Joe' },
            { name: 'Emma' },
            { name: 'Harry' },
            { name: 'Rachel' }
        ]);
    })
  );

  it('does not change classical usage', function (done) {
    setTimeout(done, 2000);
    console.log('All good');
  });
});

How It Works

The module monkey patches the Runnable.prototype.run method of mocha to enable the usage of Highland streams. In contrast to other npm packages, this is a plugin and extends mocha at runtime - allowing you to use any compatible mocha version.

License

MIT

Keywords

highland

FAQs

Package last updated on 23 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts