Awesome
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) in the form of ECMAScript AST defined in The ESTree Spec (formerly known as Mozilla SpiderMonkey Parser API), to instrument power-assert feature into the code. espower-loader
also adjusts line and column number in stack traces by using source-map-support module.
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
,gulp-espower
, and so on).
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')({
pattern: '{src,test}/**/*.js'
});
You can specify options for espower
module explicitly.
require('espower-loader')({
// directory where match starts with
cwd: process.cwd(),
// glob pattern using minimatch module
pattern: '{src,test}/**/*.js',
// options for espower module
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])',
'assert.deepStrictEqual(actual, expected, [message])',
'assert.notDeepStrictEqual(actual, expected, [message])'
]
}
});
OUR SUPPORT POLICY
We support Node under maintenance. In other words, we stop supporting old Node version when their maintenance ends.
This means that any other environment is not supported.
NOTE: If espower-source works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk.
CHANGELOG
See CHANGELOG
AUTHOR
CONTRIBUTORS
LICENSE
Licensed under the MIT license.