Create visitor object to be used with estraverse.replace. Visitor can be customized by options.
options
Object for configuration options. passed options is Object.assigned with default options. If not passed, default options will be used.
options.assertionPatterns
Target patterns for assertion removal.
If callee name (for example, assert.equal) matches exactly and number of arguments is satisfied, then the assertion will be removed. Patterns are handled with escallmatch. Any arguments enclosed in bracket (for example, [message]) means optional parameters. Without bracket means mandatory parameters.
options.requirePatterns
Target patterns for require call removal. Must be in form of assignments.
will remove var assert = require("assert"), let assert = require("assert"), const assert = require("assert") and var assert; assert = require("assert") as well.
options.importPatterns
Target patterns for import declaration removal.
For example,
{
importPatterns: [
'import assert from "assert"',
'import * as assert from "assert"',
'import assert from "power-assert"',
'import * as assert from "power-assert"'
]
Expose
createVisitor
to make assertion and declaration patterns configurable.var visitor = unassert.createVisitor(options)
object
(visitor object for estraverse)Create visitor object to be used with
estraverse.replace
. Visitor can be customized byoptions
.options
Object for configuration options. passed
options
isObject.assign
ed with default options. If not passed, default options will be used.options.assertionPatterns
Target patterns for assertion removal.
If callee name (for example,
assert.equal
) matches exactly and number of arguments is satisfied, then the assertion will be removed. Patterns are handled with escallmatch. Any arguments enclosed in bracket (for example,[message]
) means optional parameters. Without bracket means mandatory parameters.options.requirePatterns
Target patterns for
require
call removal. Must be in form of assignments.For example,
will remove
var assert = require("assert")
,let assert = require("assert")
,const assert = require("assert")
andvar assert; assert = require("assert")
as well.options.importPatterns
Target patterns for import declaration removal.
For example,