Home

Awesome

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.

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

Caution

For webpack3 or lower, you need to use the 1.x release of webpack-espower-loader.

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

Usage

Configure webpack.config.js to apply webpack-espower-loader through webpack loader transformation chain. Options are passed through to espower. If not passed, default options (Same as espower.defaultOptions()) will be used.

{
    module: {
        exprContextCritical: false,
        rules: [{
            test: /_test\.js$/,
            use: [{
                loader: "webpack-espower-loader",
                options: {
                    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.

Author

Contributors

License

Licensed under the MIT license. See LICENSE.