espower-loader
Power Assert feature instrumentor on the fly.
DESCRIPTION
espower-loader
is a Node.js module loader that enhances target sources on the fly. So you can instrument Power Assert feature without code generation for now.
espower-loader
applies espower to target sources on loading them. espower
manipulates assertion expression (JavaScript Code) represented as Mozilla JavaScript AST, to instrument power-assert feature into the code.
Please note that espower-loader
is a beta version product. Pull-requests, issue reports and patches are always welcomed. See power-assert project for more documentation.
FYI: You may be interested in intelli-espower-loader to go one step further. With intelli-espower-loader, you don't need to create loader file (like enable-power-assert.js
). Just define test directory in package.json
wow!
EXAMPLE
You can instrument power-assert
without code generation (e.g. without using grunt-espower
).
For mocha, Just add --require
option.
$ mocha --require ./path/to/enable-power-assert test/some_test_using_powerassert.js
where enable-power-assert.js
somewhere in your project is,
require('espower-loader')({
cwd: process.cwd(),
pattern: 'test/**/*.js'
});
You can specify espower
options explicitly.
require('espower-loader')({
cwd: process.cwd(),
pattern: 'test/**/*.js',
espowerOptions: {
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
AUTHOR
LICENSE
Licensed under the MIT license.