Power Assert instrumentor module for webpack
JavaScript
Latest commit 00fd3d6 Nov 12, 2015 @zoncoen zoncoen Merge pull request #5 from power-assert-js/faq
Add FAQ section to README

README.md

Build Status NPM package Dependency Status License

webpack-espower-loader

Power Assert instrumentor module for webpack.

Description

webpack-espower-loader is a webpack loader module for power-assert. webpack-espower-loader applies espower to target sources through webpack loader chain.

Please note that webpack-espower-loader is a beta version project. Pull-requests, issue reports and patches are always welcomed.

See power-assert project for more documentation.

FAQ

webpack-espower-loader does not work with babel-loader!

webpack-espower-loader does not work with babel-loader due to the change of transpiled code since babel 5.0. Please use babel-plugin-espower with babel-loader.

Installation

Install power-assert and webpack-espower-loader via npm:

$ npm install --save-dev webpack-espower-loader

Usage

Require power-assert in your test.

--- a/test/your_test.js
+++ b/test/your_test.js
@@ -1,4 +1,4 @@
-var assert = require('assert');
+var assert = require('power-assert');

Configure webpack.config.js to apply webpack-espower-loader through webpack loader transformation chain.

{
    module: {
        loaders: [
            { test: /_test\.js$/, loader: "webpack-espower-loader" }
        ]
    }
}

You can pass espower options by including to webpack configuration object (e.g. webpack.config.js). If not passed, default options (Same as espower.defaultOptions()) will be used, but destructive option is set to true by espower-source module.

{
    espower: {
        patterns: [
            'assert(value, [message])',
            'assert.ok(value, [message])',
            'assert.equal(actual, expected, [message])',
            'assert.notEqual(actual, expected, [message])',
            'assert.strictEqual(actual, expected, [message])',
            'assert.notStrictEqual(actual, expected, [message])',
            'assert.deepEqual(actual, expected, [message])',
            'assert.notDeepEqual(actual, expected, [message])'
        ]
    }
}

Changelog

See CHANGELOG.md.

License

Licensed under the MIT license. See LICENSE.