gulp-espower

A gulp plugin for power-assert

npm install gulp-espower
6 downloads in the last day
9 downloads in the last week
58 downloads in the last month

gulp-espower NPM version Build Status Dependency Status

A gulp plugin for power-assert.

Description

gulp-espower is a gulp plugin to instrument "Power Assert" feature into your code.

Internally, gulp-espower task uses espower module that manipulates assertion expression (JavaScript Code) represented as Mozilla JavaScript AST, to instrument power-assert feature into the code. The magic is done by using Esprima and Escodegen.

Please note that gulp-espower is a beta version product. Pull-requests, issue reports and patches are always welcomed. See power-assert project for more documentation.

Usage

First, install gulp-espower as a development dependency:

npm install --save-dev gulp-espower

Then, add it to your gulpfile.js:

var espower = require("gulp-espower");

gulp.src("./test/*.js")
    .pipe(espower())
    .pipe(gulp.dest("./dist"));

API

espower(options)

options.powerAssertVariableName

Type: String Default value: 'assert'

Target variable name to instrument.

options.lineSeparator

Type: String Default value: '\n'

Line separator in target sources.

options.targetMethods

Type: Object Default value:

targetMethods: {
    oneArg: [
        'ok'
    ],
    twoArgs: [
        'equal',
        'notEqual',
        'strictEqual',
        'notStrictEqual',
        'deepEqual',
        'notDeepEqual'
    ]
}

Target assertion methods to insrtument.

  • oneArg array for assertion methods with a expression argument (like assert.ok(actual))
  • twoArgs array for assertion methods with two expression arguments (like assert.equal(actual, expected))

License

Licensed under the MIT license.

npm loves you