@rabbitcc/babel
v0.0.3
Published
babel plugins
Downloads
13
Readme
babel plugins
remove test plugin
This plugin erasure describe() and import assert from 'assert'. Allow you write test in your source file, e.g.
Input:
function sum(a, b) {
return a + b
}
/**
* test
*/
import assert from 'assert'
describe('sum()', () => {
it('should eq 3', () => {
assert.ok(sum(1, 2), 3)
})
})Output:
function sum(a, b) {
return a + b
}
/**
* test
*/
// 'import' and 'describe' was removedUsage
{
"plugins": ["@rabbitcc/remove-test"]
}
// or with options
{
"plugins": [["@rabbitcc/remove-test", {
// options see below..
}]]
}
// remove on production evn
{
"env": {
"plugins": ["@rabbitcc/remove-test"]
}
}Plugin options:
type Options = {
/**
* remove test helper modules if match test, e.g. "import 'foo'" with `test: /foo/`
*/
test?: RegExp,
/**
* like test, used for remove test helpers modules
*/
include?: Array<string>
}