diff --git a/.travis.yml b/.travis.yml index fe3a103..9169391 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js sudo: false node_js: - - "6" # to be removed on "April 2019" - "8" # to be removed on "December 2019" - "10" # to be removed on "April 2021" - - "11" # to be removed on "June 2019" + - "12" # to be removed on "April 2022" diff --git a/README.md b/README.md index 6a0b913..6ba7be9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Babel plugin for power-assert. [![Build Status][travis-image]][travis-url] [![NPM version][npm-image]][npm-url] -[![Dependency Status][depstat-image]][depstat-url] +[![Code Style][style-image]][style-url] [![License][license-image]][license-url] @@ -318,7 +318,6 @@ You can customize configs such as assertion patterns via [.babelrc](https://babe ], "plugins": [ ["babel-plugin-espower", { - "embedAst": true, "patterns": [ "assert.isNull(object, [message])", "assert.same(actual, expected, [message])", @@ -336,7 +335,6 @@ require('@babel/register')({ presets: [...], plugins: [ ['babel-plugin-espower', { - embedAst: true, patterns: [ 'assert.isNull(object, [message])', 'assert.same(actual, expected, [message])', @@ -356,7 +354,6 @@ var transformed = babel.transform(jsCode, { presets: [...], plugins: [ ['babel-plugin-espower', { - embedAst: true, patterns: [ 'assert.isNull(object, [message])', 'assert.same(actual, expected, [message])', @@ -390,7 +387,7 @@ Configuration options for `babel-plugin-espower`. If not passed, default options 'assert.deepStrictEqual(actual, expected, [message])', 'assert.notDeepStrictEqual(actual, expected, [message])' ], - embedAst: true, + embedAst: false, // false by default, true if there are some syntax plugins configured visitorKeys: babel.types.VISITOR_KEYS, astWhiteList: babel.types.BUILDER_KEYS, sourceRoot: process.cwd(), @@ -402,6 +399,7 @@ Configuration options for `babel-plugin-espower`. If not passed, default options #### options.embedAst If you want to use non-ECMASCript-standard features such as JSX tags in your `assert()`, you should set `embedAst` option to `true`. +Since 4.0.0, `embedAst` option is configured automatically. ```js assert(shallow(<Foo />).is('.foo')); @@ -444,8 +442,8 @@ Licensed under the [MIT](https://github.com/power-assert-js/babel-plugin-espower [travis-url]: https://travis-ci.org/power-assert-js/babel-plugin-espower [travis-image]: https://secure.travis-ci.org/power-assert-js/babel-plugin-espower.svg?branch=master -[depstat-url]: https://gemnasium.com/power-assert-js/babel-plugin-espower -[depstat-image]: https://gemnasium.com/power-assert-js/babel-plugin-espower.svg +[style-url]: https://github.com/Flet/semistandard +[style-image]: https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg [license-url]: https://github.com/power-assert-js/babel-plugin-espower/blob/master/LICENSE [license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg diff --git a/index.js b/index.js index f4ce2a8..187773e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ /** * babel-plugin-espower: * Babel plugin for power-assert - * + * * https://github.com/power-assert-js/babel-plugin-espower * * Copyright (c) 2015-2019 Takuto Wada diff --git a/lib/argument-modification.js b/lib/argument-modification.js new file mode 100644 index 0000000..eba14f4 --- /dev/null +++ b/lib/argument-modification.js @@ -0,0 +1,132 @@ +'use strict'; + +const define = require('./define-properties'); +const createIsNodeToBeCaptured = require('./to-be-captured'); +const { createNewArgumentRecorderNode, createNewAssertionMessageNode } = require('./create-node'); + +class ArgumentModification { + constructor (babel, match, options, cloneAst, assertionNodePath, metadataIdent) { + this.babel = babel; + this.options = options; + this.currentArgumentMatchResult = match; + this.assertionNodePath = assertionNodePath; + this.metadataIdent = metadataIdent; + this.cloneAst = cloneAst; + this.currentArgumentNodePath = null; + this.argumentModified = false; + this.messageUpdated = false; + this.isNodeToBeCaptured = createIsNodeToBeCaptured(babel.types); + } + + toBeCaptured (nodePath) { + return this.isNodeToBeCaptured(nodePath); + } + + isLeaving (nodePath) { + return this.currentArgumentNodePath === nodePath; + } + + isCapturing () { + return true; + } + + isMessageUpdated () { + return !!this.messageUpdated; + } + + isArgumentModified () { + return !!this.argumentModified; + } + + enter (nodePath) { + // entering target argument + this.currentArgumentNodePath = nodePath; + // create recorder per argument + this.argumentRecorder = createNewArgumentRecorderNode({ + nodePath, + types: this.babel.types, + visitorKeys: this.options.visitorKeys, + metadataIdent: this.metadataIdent, + cloneAst: this.cloneAst, + calleeNode: this.assertionNodePath.node.callee, + matchIndex: this.currentArgumentMatchResult.index + }); + } + + leave (nodePath) { + const currentNode = nodePath.node; + const shouldCaptureValue = this.toBeCaptured(nodePath); + const pathToBeCaptured = shouldCaptureValue ? currentNode._espowerEspath : null; + const shouldCaptureArgument = this.isArgumentModified() || shouldCaptureValue; + const resultNode = shouldCaptureArgument ? this.captureArgument(currentNode, pathToBeCaptured) : currentNode; + if (this.currentArgumentMatchResult.name === 'message' && this.currentArgumentMatchResult.kind === 'optional') { + this.messageUpdated = true; + // enclose it in AssertionMessage + return createNewAssertionMessageNode({ + nodePath, + types: this.babel.types, + visitorKeys: this.options.visitorKeys, + metadataIdent: this.metadataIdent, + cloneAst: this.cloneAst, + originalMessageNode: resultNode, + matchIndex: this.currentArgumentMatchResult.index + }); + } else { + return resultNode; + } + } + + captureNode (nodePath) { + const currentNode = nodePath.node; + const espath = currentNode._espowerEspath; + return this.insertRecorder(currentNode, espath, '_tap'); + } + + captureArgument (currentNode, espath) { + return this.insertRecorder(currentNode, espath, '_rec'); + } + + insertRecorder (currentNode, espath, methodName) { + const receiver = this.argumentRecorder; + const types = this.babel.types; + const args = [ + currentNode + ]; + if (espath) { + args.push(types.valueToNode(espath)); + } + const newNode = types.callExpression( + types.memberExpression(receiver, types.identifier(methodName)), + args + ); + define(newNode, { _generatedByEspower: true }); + this.argumentModified = true; + return newNode; + } +} + +class NoModification { + enter (nodePath) { + this.currentArgumentNodePath = nodePath; + } + leave (nodePath) { + return nodePath; + } + isLeaving (nodePath) { + return this.currentArgumentNodePath === nodePath; + } + isCapturing () { + return false; + } + isMessageUpdated () { + return false; + } + isArgumentModified () { + return false; + } +} + +module.exports = { + ArgumentModification, + NoModification +}; diff --git a/lib/argument-recorder.js b/lib/argument-recorder.js new file mode 100644 index 0000000..91637dc --- /dev/null +++ b/lib/argument-recorder.js @@ -0,0 +1,165 @@ +'use strict'; +module.exports = function () { + const isPromiseLike = (o) => o !== null && + typeof o === 'object' && + typeof o.then === 'function' && + typeof o.catch === 'function'; + + const mark = (_this, s) => { + return function () { + const args = Array.from(arguments); + _this.status = s; + _this.value = (args.length === 1) ? args[0] : args; + }; + }; + + class $Promise$ { + constructor (prms) { + this.status = 'pending'; + prms.then(mark(this, 'resolved'), mark(this, 'rejected')); + } + } + + const wrap = (v) => isPromiseLike(v) ? new $Promise$(v) : v; + + class ArgumentRecorder { + /** + * @typedef {Object} AssertionMetadata + * @property {string} content + * @property {string} filepath + * @property {number} line + * @property {number} version + * @property {string} pattern + * @property {array} params + * @property {boolean} [async] - true if enclosed in async function + * @property {boolean} [generator] - true if enclosed in generator function + * @property {string} [ast] - stringified AST + * @property {string} [tokens] - stringified tokens + * @property {string} [visitorKeys] - stringified visitorKeys + */ + + /** + * record argument value and metadata silently + * @param {function} callee - callee of target argument + * @param {AssertionMetadata} am - generated metadata for target assertion + * @param {number} matchIndex - index of matched parameter + */ + constructor (callee, am, matchIndex) { + this._callee = callee; + this._am = am; + this._logs = []; + this._recorded = null; + this._val = null; + this._idx = matchIndex; + const conf = am.params[matchIndex]; + this._isBlock = !!conf.block; + } + + /** + * @return {AssertionMetadata} - AssertionMetadata for target assertion + */ + metadata () { + return this._am; + } + + /** + * @return {number} - index of matched parameter + */ + matchIndex () { + return this._idx; + } + + /** + * @return {*} - recorded actual value of target argument + */ + val () { + return this._val; + } + + /** + * tap capturable node value with its espath then store them as a Log + * @param {*} value - actual value of target node + * @param {string} espath - espath of target node in AST + * @return {*} - the original value + */ + _tap (value, espath) { + this._logs.push({ + value: wrap(value), + espath + }); + return value; + } + + /** + * record argument value silently then clear captured logs + * optionally, proxy block argument then store its result as a Log + * @param {*} value - actual value of target argument + * @param {string} [espath] - espath of target node in AST + * @return {*|ArgumentRecorder} - ArgumentRecorder or actual value of target argument + */ + _rec (value, espath) { + const empowered = this._callee && this._callee._empowered; + try { + if (!empowered) return value; + if (!espath) return this; + + const log = { + value: wrap(value), + espath + }; + this._logs.push(log); + + if (this._isBlock && empowered && typeof value === 'function') { + value = new Proxy(value, { + apply (target, thisArg, args) { + try { + const ret = target.apply(thisArg, args); + log.value = wrap(ret); + return ret; + } catch (e) { + log.value = e; + throw e; + } + } + }); + } + + return this; + } finally { + if (empowered) { + this._recorded = { + value, + logs: [].concat(this._logs) + }; + } + this._val = value; // actual value of target argument + this._logs = []; // clear logs + } + } + + /** + * @typedef {Object} Log + * @property {*} value - recorded actual value of target node + * @property {string} espath - espath of target node in AST + */ + + /** + * @typedef {Object} RecordedData + * @property {*} value - recorded actual value of target argument + * @property {Log[]} logs - recorded Logs + */ + + /** + * return RecordedData then clear cache + * @return {RecordedData} - captured value and metadata of target argument + */ + eject () { + const ret = this._recorded; + this._recorded = null; + this._val = null; + return ret; + } + } + + return ArgumentRecorder; +}; diff --git a/lib/assertion-message.js b/lib/assertion-message.js new file mode 100644 index 0000000..edf104f --- /dev/null +++ b/lib/assertion-message.js @@ -0,0 +1,97 @@ +'use strict'; +module.exports = function () { + const _s = '\n\n '; + + class AssertionMessage { + /** + * @typedef {Object} AssertionMetadata + * @property {string} content + * @property {string} filepath + * @property {number} line + * @property {number} version + * @property {string} pattern + * @property {array} args + * @property {boolean} [async] - true if enclosed in async function + * @property {boolean} [generator] - true if enclosed in generator function + * @property {string} [ast] - stringified AST + * @property {string} [tokens] - stringified tokens + * @property {string} [visitorKeys] - stringified visitorKeys + */ + + /** + * @param {AssertionMetadata} am - AssertionMetadata for target assertion + * @param {number} matchIndex - index of matched parameter + * @param {string|ArgumentRecorder} [msgOrRec] - maybe enhanced message + */ + constructor (am, matchIndex, msgOrRec) { + this._am = am; + this._idx = matchIndex; + this._msgOrRec = msgOrRec; + } + + /** + * @return {AssertionMetadata} - AssertionMetadata for target assertion + */ + metadata () { + return this._am; + } + + /** + * @return {number} - index of matched parameter + */ + matchIndex () { + return this._idx; + } + + /** + * @return {*} - maybe enhanced message + */ + val () { + if (this._msgOrRec && typeof this._msgOrRec.val === 'function') { + return this._msgOrRec.val(); + } else { + return this._msgOrRec; + } + } + + /** + * @typedef {Object} Log + * @property {*} value - recorded actual value of target node + * @property {string} espath - espath of target node in AST + */ + + /** + * @typedef {Object} RecordedData + * @property {*} value - recorded actual value of target argument + * @property {Log[]} logs - recorded Logs + */ + + /** + * return RecordedData then clear cache + * @return {RecordedData} - captured value and metadata of target argument + */ + eject () { + if (this._msgOrRec && typeof this._msgOrRec.eject === 'function') { + return this._msgOrRec.eject(); + } else { + return { + value: this.val(), + logs: [] + }; + } + } + + /** + * @return {string} - string representation of target assertion call + */ + toString () { + let msg = typeof this._msgOrRec === 'string' ? this._msgOrRec : ''; + msg += `${_s}# ${this._am.filepath}:${this._am.line}`; + msg += `${_s}${this._am.content}`; + msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; + msg += `\n`; + return msg; + } + } + return AssertionMessage; +}; diff --git a/lib/babel-assertion-visitor.js b/lib/babel-assertion-visitor.js index 07f8cc8..a8a939b 100644 --- a/lib/babel-assertion-visitor.js +++ b/lib/babel-assertion-visitor.js @@ -1,343 +1,377 @@ 'use strict'; -var EspowerLocationDetector = require('espower-location-detector'); -var estraverse = require('estraverse'); -var cloneWithWhitelist = require('espurify').cloneWithWhitelist; -var babelParser = require('@babel/parser'); -var babelgen = require('@babel/generator'); -var assign = require('core-js/library/fn/object/assign'); -var define = require('./define-properties'); -var toBeCaptured = require('./to-be-captured'); -var toBeSkipped = require('./to-be-skipped'); -var fs = require('fs'); -var helperCode = '(' + - fs.readFileSync(require.resolve('./power-assert-recorder.js'), 'utf8') - .split('\n') - .slice(2) - .join('\n') - + ')()'; +const pkg = require('../package.json'); +const EspowerLocationDetector = require('espower-location-detector'); +const { ArgumentModification, NoModification } = require('./argument-modification'); +const { createNewAssertionMessageNode, getOrCreateNode } = require('./create-node'); +const estraverse = require('estraverse'); +const cloneWithWhitelist = require('espurify').cloneWithWhitelist; +const babelParser = require('@babel/parser'); +const babelgen = require('@babel/generator'); +const define = require('./define-properties'); +const createIsNodeToBeCaptured = require('./to-be-captured'); +const createIsNodeToBeSkipped = require('./to-be-skipped'); +const wrappedInGenerator = (jsCode) => `function *wrapper() { ${jsCode} }`; +const wrappedInAsync = (jsCode) => `async function wrapper() { ${jsCode} }`; +const offsetAndSlimDownTokens = (tokens) => { + const result = []; + let i, token, newToken, columnOffset; + for (i = 0; i < tokens.length; i += 1) { + token = tokens[i]; + if (i === 0) { + columnOffset = token.loc.start.column; + } + newToken = { + type: { + label: token.type.label + } + }; + if (typeof token.value !== 'undefined') { + newToken.value = token.value; + } + newToken.range = [ + token.loc.start.column - columnOffset, + token.loc.end.column - columnOffset + ]; + result.push(newToken); + } + return result; +}; -function BabelAssertionVisitor (babel, matcher, options) { +class BabelAssertionVisitor { + constructor (babel, patternMatcher, options) { this.babel = babel; - this.matcher = matcher; + this.patternMatcher = patternMatcher; this.options = options; - this.currentArgumentNodePath = null; - this.argumentModified = false; - this.valueRecorder = null; - this.locationDetector = new EspowerLocationDetector(this.options); - var babelTemplate = babel.template; - this.helperTemplate = babelTemplate(helperCode); - var whiteListWithRange = Object.keys(options.astWhiteList).reduce(function (acc, key) { - acc[key] = options.astWhiteList[key].concat(['range']); - return acc; + this.argumentModifiedHistory = []; + this.messageUpdated = false; + const whiteListWithRange = Object.keys(options.astWhiteList).reduce((acc, key) => { + acc[key] = options.astWhiteList[key].concat(['range']); + return acc; }, {}); - this.purifyAst = cloneWithWhitelist(whiteListWithRange); -} + this.cloneAst = cloneWithWhitelist(whiteListWithRange); + this.isNodeToBeSkipped = createIsNodeToBeSkipped(babel.types); + this.isNodeToBeCaptured = createIsNodeToBeCaptured(babel.types); + } -BabelAssertionVisitor.prototype.enter = function (nodePath) { + enter (nodePath) { this.assertionNodePath = nodePath; - var currentNode = nodePath.node; - this.location = this.locationDetector.locationFor(currentNode); - var enclosingFunc = this.findEnclosingFunction(nodePath); + const enclosingFunc = this.findEnclosingFunction(nodePath); this.withinGenerator = enclosingFunc && enclosingFunc.generator; this.withinAsync = enclosingFunc && enclosingFunc.async; - this.generateCanonicalCode(nodePath, currentNode); // should be next to enclosingFunc detection + this.canonicalCode = this.generateCanonicalCode(nodePath); + if (this.options.embedAst) { + this.generateAstAndTokensAndVisitorKeys(nodePath, this.canonicalCode); + } + // should be before generateMetadata + this.configIdent = this.generatePowerAssertConfig(nodePath); + // should be after configIdent creation and enclosingFunc detection + this.metadataIdent = this.generateMetadata(nodePath); // store original espath for each node - var visitorKeys = this.options.visitorKeys; - estraverse.traverse(currentNode, { - keys: visitorKeys, - enter: function (node) { - if (this.path()) { - var espath = this.path().join('/'); - define(node, { _espowerEspath: espath }); - } + const visitorKeys = this.options.visitorKeys; + estraverse.traverse(nodePath.node, { + keys: visitorKeys, + enter: function (node) { + if (this.path()) { + const _espowerEspath = this.path().join('/'); + define(node, { _espowerEspath }); } + } }); -}; + } -BabelAssertionVisitor.prototype.enterArgument = function (nodePath) { - var currentNode = nodePath.node; - var parentNode = nodePath.parent; - var argMatchResult = this.matcher.matchArgument(currentNode, parentNode); - if (!argMatchResult) { - return; - } - if (argMatchResult.name === 'message' && argMatchResult.kind === 'optional') { - // skip optional message argument - return; - } - this.verifyNotInstrumented(currentNode); - // create recorder per argument - this.valueRecorder = this.createNewRecorder(nodePath); - // entering target argument - this.currentArgumentNodePath = nodePath; -}; - -BabelAssertionVisitor.prototype.leave = function (nodePath) { - var currentNode = nodePath.node; - var visitorKeys = this.options.visitorKeys; - estraverse.traverse(currentNode, { + leave (nodePath) { + const currentNode = nodePath.node; + const visitorKeys = this.options.visitorKeys; + const modifiedSome = this.argumentModifiedHistory.some((b) => b); + try { + return modifiedSome ? this.appendMessage(nodePath) : currentNode; + } finally { + this.argumentModifiedHistory = []; + this.messageUpdated = false; + this.metadataIdent = null; + estraverse.traverse(currentNode, { keys: visitorKeys, enter: function (node) { - delete node._espowerEspath; + delete node._espowerEspath; } - }); -}; + }); + } + } -BabelAssertionVisitor.prototype.leaveArgument = function (resultTree) { - try { - return this.argumentModified ? this.captureArgument(resultTree) : resultTree; - } finally { - this.currentArgumentNodePath = null; - this.argumentModified = false; - this.valueRecorder = null; + enterArgument (nodePath) { + const currentNode = nodePath.node; + const parentNode = nodePath.parent; + const argMatchResult = this.patternMatcher.matcher.matchArgument(currentNode, parentNode); + if (argMatchResult) { + this.verifyNotInstrumented(currentNode); + this.currentModification = new ArgumentModification(this.babel, argMatchResult, this.options, this.cloneAst, this.assertionNodePath, this.metadataIdent); + } else { + this.currentModification = new NoModification(); } -}; + this.currentModification.enter(nodePath); + } -BabelAssertionVisitor.prototype.captureNode = function (nodePath) { - var currentNode = nodePath.node; - var t = this.babel.types; - this.argumentModified = true; - var relativeEsPath = currentNode._espowerEspath; - var newNode = t.callExpression( - t.memberExpression(this.valueRecorder, t.identifier('_capt')), - [ - currentNode, - t.valueToNode(relativeEsPath) - ]); - define(newNode, { _generatedByEspower: true }); - return newNode; -}; + leaveArgument (nodePath) { + const retNode = this.currentModification.leave(nodePath); + this.messageUpdated = this.currentModification.isMessageUpdated(); + this.argumentModifiedHistory.push(this.currentModification.isArgumentModified()); + this.currentModification = null; + return retNode; + } -BabelAssertionVisitor.prototype.toBeSkipped = function (nodePath) { - return toBeSkipped(this.babel.types, nodePath); -}; + captureNode (nodePath) { + return this.currentModification.captureNode(nodePath); + } -BabelAssertionVisitor.prototype.toBeCaptured = function (nodePath) { - return toBeCaptured(this.babel.types, nodePath); -}; + toBeSkipped (nodePath) { + return this.isNodeToBeSkipped(nodePath); + } -BabelAssertionVisitor.prototype.isArgumentModified = function () { - return !!this.argumentModified; -}; + toBeCaptured (nodePath) { + return this.isNodeToBeCaptured(nodePath); + } -BabelAssertionVisitor.prototype.isCapturingArgument = function () { - return !!this.currentArgumentNodePath; -}; + isCapturingArgument () { + return this.currentModification && this.currentModification.isCapturing(); + } -BabelAssertionVisitor.prototype.isLeavingAssertion = function (nodePath) { + isLeavingAssertion (nodePath) { return this.assertionNodePath === nodePath; -}; + } -BabelAssertionVisitor.prototype.isLeavingArgument = function (nodePath) { - return this.currentArgumentNodePath === nodePath; -}; + isLeavingArgument (nodePath) { + return this.currentModification.isLeaving(nodePath); + } -BabelAssertionVisitor.prototype.isGeneratedNode = function (nodePath) { - var currentNode = nodePath.node; - return !!currentNode._generatedByEspower; -}; - -// internal + isGeneratedNode ({ node }) { + return !!node._generatedByEspower; + } -BabelAssertionVisitor.prototype.generateCanonicalCode = function (nodePath, node) { - var file = nodePath.hub.file; - var gen = new babelgen.CodeGenerator(node, { concise: true, comments: false }); - var output = gen.generate(); - this.canonicalCode = output.code; - if (!this.options.embedAst) { - return; - } - var astAndTokens = this.parseCanonicalCode(file, this.canonicalCode); - this.ast = JSON.stringify(this.purifyAst(astAndTokens.expression)); - this.tokens = JSON.stringify(astAndTokens.tokens); - var _this = this; - var types = this.babel.types; - this.visitorKeys = this.getOrCreateNode(nodePath, 'powerAssertVisitorKeys', function () { - return types.stringLiteral(JSON.stringify(_this.options.visitorKeys)); - }); -}; + // internal -BabelAssertionVisitor.prototype.parseCanonicalCode = function (file, code) { - var ast, tokens; + generateCanonicalCode (nodePath) { + const gen = new babelgen.CodeGenerator(nodePath.node, { concise: true, comments: false }); + const { code } = gen.generate(); + return code; + } - function doParse(wrapper) { - var content = wrapper ? wrapper(code) : code; - var output = babelParser.parse(content, assign({}, file.opts.parserOpts, {tokens: true})); - if (wrapper) { - ast = output.program.body[0].body; - tokens = output.tokens.slice(6, -2); - } else { - ast = output.program; - tokens = output.tokens.slice(0, -1); - } - } + generateAstAndTokensAndVisitorKeys (nodePath, canonicalCode) { + const file = nodePath.hub.file; + const types = this.babel.types; + const { tokens, expression } = this.parseCanonicalCode(file, canonicalCode); + this.ast = JSON.stringify(this.cloneAst(expression)); + this.tokens = JSON.stringify(tokens); + const visitorKeys = this.options.visitorKeys; + const keyName = 'powerAssertVisitorKeys'; + const generateNode = () => { + return types.stringLiteral(JSON.stringify(visitorKeys)); + }; + this.visitorKeysNode = getOrCreateNode({ nodePath, keyName, generateNode, visitorKeys }); + } + parseCanonicalCode (file, code) { + let wrapper; if (this.withinAsync) { - doParse(wrappedInAsync); + wrapper = wrappedInAsync; } else if (this.withinGenerator) { - doParse(wrappedInGenerator); - } else { - doParse(); + wrapper = wrappedInGenerator; } - - var exp = ast.body[0].expression; - var columnOffset = exp.loc.start.column; - var offsetTree = estraverse.replace(exp, { - keys: this.options.visitorKeys, - enter: function (eachNode) { - eachNode.range = [ - eachNode.loc.start.column - columnOffset, - eachNode.loc.end.column - columnOffset - ]; - delete eachNode.loc; - return eachNode; - } + const { ast, tokens } = this.parseWithWrapper(file, code, wrapper); + const expr = ast.body[0].expression; + const columnOffset = expr.loc.start.column; + const visitorKeys = this.options.visitorKeys; + const offsetTree = estraverse.replace(expr, { + keys: visitorKeys, + enter: function (eachNode) { + eachNode.range = [ + eachNode.loc.start.column - columnOffset, + eachNode.loc.end.column - columnOffset + ]; + delete eachNode.loc; + return eachNode; + } }); return { - tokens: offsetAndSlimDownTokens(tokens), - expression: offsetTree + tokens: offsetAndSlimDownTokens(tokens), + expression: offsetTree }; -}; + } -function wrappedInGenerator (jsCode) { - return 'function *wrapper() { ' + jsCode + ' }'; -} + parseWithWrapper (file, code, wrapper) { + let ast, tokens; + const content = wrapper ? wrapper(code) : code; + const output = babelParser.parse(content, Object.assign({}, file.opts.parserOpts, { tokens: true })); + if (wrapper) { + ast = output.program.body[0].body; + tokens = output.tokens.slice(6, -2); + } else { + ast = output.program; + tokens = output.tokens.slice(0, -1); + } + return { + ast, + tokens + }; + } -function wrappedInAsync (jsCode) { - return 'async function wrapper() { ' + jsCode + ' }'; -} + appendMessage (nodePath) { + const currentNode = nodePath.node; + if (this.messageUpdated) { + // AssertionMessage is already merged with existing message argument + return currentNode; + } + const sigs = this.patternMatcher.matcher.argumentSignatures(); + const numDefinedParams = sigs.length; + const lastParam = sigs[numDefinedParams - 1]; + const hasOptionalMessageArgument = (lastParam.name === 'message' && lastParam.kind === 'optional'); + if (!hasOptionalMessageArgument) { + return currentNode; + } + const numActualArgs = currentNode.arguments.length; + const onlyLastArgumentIsOmitted = (numDefinedParams - numActualArgs === 1); -function offsetAndSlimDownTokens (tokens) { - var i, token, newToken, result = []; - var columnOffset; - for(i = 0; i < tokens.length; i += 1) { - token = tokens[i]; - if (i === 0) { - columnOffset = token.loc.start.column; - } - newToken = { - type: { - label: token.type.label - } - }; - if (typeof token.value !== 'undefined') { - newToken.value = token.value; - } - newToken.range = [ - token.loc.start.column - columnOffset, - token.loc.end.column - columnOffset - ]; - result.push(newToken); + const params = { + nodePath, + types: this.babel.types, + visitorKeys: this.options.visitorKeys, + metadataIdent: this.metadataIdent, + cloneAst: this.cloneAst + }; + + if (onlyLastArgumentIsOmitted) { + // appending AssertionMessage in place of omitted message argument (as index -1) + currentNode.arguments.push(createNewAssertionMessageNode(params)); + } else if (numDefinedParams === numActualArgs) { + const lastIndex = numActualArgs - 1; + const lastActualArg = currentNode.arguments[lastIndex]; + if (this.toBeSkipped(lastActualArg)) { + // last arg may be a string literal + currentNode.arguments[lastIndex] = createNewAssertionMessageNode(Object.assign({}, { + originalMessageNode: lastActualArg, + matchIndex: lastIndex + }, params)); + } } - return result; -} + return currentNode; + } + + generatePowerAssertConfig (nodePath) { + const types = this.babel.types; + const options = this.options; + const generateNode = () => { + const patternIndexIdent = types.identifier('ptnidx'); + const contentIdent = types.identifier('content'); + const lineIdent = types.identifier('line'); + const extraIdent = types.identifier('extra'); + const transpilerIdent = types.identifier('transpiler'); + const versionIdent = types.identifier('version'); + const filepathIdent = types.identifier('filepath'); + const patternsIdent = getOrCreateNode({ + nodePath, + keyName: 'pwptn', + generateNode: () => { + const jsonStrNode = types.stringLiteral(JSON.stringify(options.patterns)); + return types.callExpression( + types.memberExpression(types.identifier('JSON'), types.identifier('parse')), + [ jsonStrNode ] + ); + }, + visitorKeys + }); + const objectAssignMethod = types.memberExpression(types.identifier('Object'), types.identifier('assign')); + const funcNode = types.arrowFunctionExpression([ + patternIndexIdent, + contentIdent, + filepathIdent, + lineIdent, + extraIdent + ], types.blockStatement([ + types.returnStatement(types.callExpression(objectAssignMethod, [ + types.objectExpression([ + types.objectProperty(transpilerIdent, types.stringLiteral(pkg.name), false, false), + types.objectProperty(versionIdent, types.stringLiteral(pkg.version), false, false), + types.objectProperty(contentIdent, contentIdent, false, true), + types.objectProperty(filepathIdent, filepathIdent, false, true), + types.objectProperty(lineIdent, lineIdent, false, true) + ]), + extraIdent, + types.memberExpression(patternsIdent, patternIndexIdent, true) + ])) + ])); + return funcNode; + }; + const visitorKeys = options.visitorKeys; + const keyName = 'pwmeta'; + return getOrCreateNode({ nodePath, keyName, generateNode, visitorKeys }); + } -BabelAssertionVisitor.prototype.captureArgument = function (node) { - var t = this.babel.types; - var props = { - content: this.canonicalCode, - filepath: this.location.source, - line: this.location.line + generateMetadata (nodePath) { + const t = this.babel.types; + const props = { }; if (this.withinAsync) { - props.async = true; + props.async = true; } if (this.withinGenerator) { - props.generator = true; + props.generator = true; } if (this.ast) { - props.ast = this.ast; + props.ast = this.ast; } if (this.tokens) { - props.tokens = this.tokens; + props.tokens = this.tokens; } - var propsNode = t.valueToNode(props); - if (this.visitorKeys) { - var visitorKeysNode = t.objectProperty(t.identifier('visitorKeys'), this.visitorKeys); - propsNode.properties.push(visitorKeysNode); + const propsNode = t.valueToNode(props); + if (this.visitorKeysNode) { + propsNode.properties.push(t.objectProperty(t.identifier('visitorKeys'), this.visitorKeysNode)); } - var newNode = t.callExpression( - t.memberExpression(this.valueRecorder, t.identifier('_expr')), - [ - node, - propsNode - ] - ); - define(newNode, { _generatedByEspower: true }); - return newNode; -}; + const locationDetector = new EspowerLocationDetector(this.options); + const { source, line } = locationDetector.locationFor(nodePath.node); + const args = [ + t.numericLiteral(this.patternMatcher.index), + t.stringLiteral(this.canonicalCode), + t.stringLiteral(source), + t.numericLiteral(line) + ]; + if (propsNode.properties.length > 0) { + args.push(propsNode); + } + const callConfigFuncNode = t.callExpression(this.configIdent, args); + const metadataIdent = nodePath.scope.generateUidIdentifier('am'); + define(metadataIdent, { _generatedByEspower: true }); + nodePath.scope.push({ id: metadataIdent, init: callConfigFuncNode }); + return metadataIdent; + } -BabelAssertionVisitor.prototype.verifyNotInstrumented = function (currentNode) { - var types = this.babel.types; + verifyNotInstrumented (currentNode) { + const types = this.babel.types; if (!types.isCallExpression(currentNode)) { - return; + return; } if (!types.isMemberExpression(currentNode.callee)) { - return; + return; } - var prop = currentNode.callee.property; - if (types.isIdentifier(prop) && prop.name === '_expr') { - var errorMessage = '[espower] Attempted to transform AST twice.'; - if (this.options.path) { - errorMessage += ' path: ' + this.options.path; - } - throw new Error(errorMessage); + const prop = currentNode.callee.property; + if (types.isIdentifier(prop) && prop.name === '_rec') { + let errorMessage = '[espower] Attempted to transform AST twice.'; + if (this.options.path) { + errorMessage += ' path: ' + this.options.path; + } + throw new Error(errorMessage); } -}; + } -BabelAssertionVisitor.prototype.createNewRecorder = function (nodePath) { - var _this = this; - var types = this.babel.types; - var helperNameNode = this.getOrCreateNode(nodePath, 'powerAssertRecorder', function () { - return types.toExpression(_this.helperTemplate()); - }); - var recorderIdent = nodePath.scope.generateUidIdentifier('rec'); - define(recorderIdent, { _generatedByEspower: true }); - var init = types.newExpression(helperNameNode, []); - define(init, { _generatedByEspower: true }); - nodePath.scope.push({ id: recorderIdent, init: init }); - return recorderIdent; -}; - -BabelAssertionVisitor.prototype.getOrCreateNode = function (nodePath, keyName, generateNode) { - var file = nodePath.hub.file; - var ident = file.get(keyName); - if (!ident) { - ident = this.createNode(nodePath, keyName, generateNode); - // helperNameNode = file.addImport('power-assert-runtime/recorder', 'default', 'recorder'); - } - return ident; -}; - -BabelAssertionVisitor.prototype.createNode = function (nodePath, keyName, generateNode) { - var file = nodePath.hub.file; - var programScope = nodePath.scope.getProgramParent(); - var ident = programScope.generateUidIdentifier(keyName); - define(ident, { _generatedByEspower: true }); - file.set(keyName, ident); - var generatedNode = generateNode(); - var visitorKeys = this.options.visitorKeys; - estraverse.traverse(generatedNode, { - keys: visitorKeys, - enter: function (node) { - define(node, { _generatedByEspower: true }); - } - }); - generatedNode._compact = true; - programScope.push({ id: ident, init: generatedNode }); - return ident; -}; - -BabelAssertionVisitor.prototype.findEnclosingFunction = function (nodePath) { + findEnclosingFunction (nodePath) { if (!nodePath) { - return null; + return null; } if (this.babel.types.isFunction(nodePath.node)) { - return nodePath.node; + return nodePath.node; } return this.findEnclosingFunction(nodePath.parentPath); -}; + } +} module.exports = BabelAssertionVisitor; diff --git a/lib/babel-espower-visitor.js b/lib/babel-espower-visitor.js index 2181381..5c08526 100644 --- a/lib/babel-espower-visitor.js +++ b/lib/babel-espower-visitor.js @@ -1,95 +1,88 @@ 'use strict'; -var CallMatcher = require('call-matcher'); -var babelParser = require('@babel/parser'); -var assign = require('core-js/library/fn/object/assign'); -var find = require('core-js/library/fn/array/find'); -var some = require('core-js/library/fn/array/some'); -var BabelAssertionVisitor = require('./babel-assertion-visitor'); -var isSpreadElement = function (node) { - return node.type === 'SpreadElement'; +const BabelAssertionVisitor = require('./babel-assertion-visitor'); +const createPatternMatchers = require('../lib/create-pattern-matchers'); +const isSpreadElement = (node) => node && node.type === 'SpreadElement'; +const withoutMatcherAndIndex = (p) => { + const res = Object.assign({}, p); + delete res.matcher; + delete res.index; + return res; }; -function BabelEspowerVisitor (babel, opts) { +class BabelEspowerVisitor { + constructor (babel, opts) { this.babel = babel; - this.matchers = opts.patterns.map(function (pattern) { - var signatureAst = babelParser.parse(pattern); - var expression = signatureAst.program.body[0].expression; - return new CallMatcher(expression, opts); + this.patternMatchers = createPatternMatchers(opts); + this.options = Object.assign({}, opts, { + patterns: this.patternMatchers.map(withoutMatcherAndIndex) }); - this.options = opts; -} - -BabelEspowerVisitor.prototype.enter = function (nodePath) { - var currentNode = nodePath.node; - var file = nodePath.hub.file; - var assertionVisitor = file.get('espowerAssertionVisitor'); + } + enter (nodePath) { + const currentNode = nodePath.node; + const file = nodePath.hub.file; + let assertionVisitor = file.get('espowerAssertionVisitor'); if (assertionVisitor) { - if (assertionVisitor.isGeneratedNode(nodePath) || assertionVisitor.toBeSkipped(nodePath)) { - // skipping this Node - // MEMO: exit() will not be called when skip() is called - nodePath.skip(); - return; - } - if (!assertionVisitor.isCapturingArgument() && !this.isCalleeOfParentCallExpression(nodePath)) { - // entering argument - assertionVisitor.enterArgument(nodePath); - } + if (assertionVisitor.isGeneratedNode(nodePath) || assertionVisitor.toBeSkipped(nodePath)) { + // skipping this Node + // MEMO: exit() will not be called when skip() is called + nodePath.skip(); + return; + } + if (!assertionVisitor.isCapturingArgument() && !this.isCalleeOfParentCallExpression(nodePath)) { + // entering argument + assertionVisitor.enterArgument(nodePath); + } } else if (nodePath.isCallExpression()) { - var matcher = find(this.matchers, function (m) { return m.test(currentNode); }); - if (matcher) { - // skip modifying argument if SpreadElement appears immediately beneath assert - if (some(currentNode.arguments, isSpreadElement)) { - nodePath.skip(); - return; - } - // entering assertion - var espowerOptions = assign({ - path: file.opts.filename, // or opts.sourceFileName? - sourceMap: file.inputMap ? file.inputMap.toObject() : false - }, this.options); - assertionVisitor = new BabelAssertionVisitor(this.babel, matcher, espowerOptions); - assertionVisitor.enter(nodePath); - file.set('espowerAssertionVisitor', assertionVisitor); + const patternMatcher = this.patternMatchers.find((pm) => pm.matcher.test(currentNode)); + if (patternMatcher) { + // skip modifying argument if SpreadElement appears immediately beneath assert + if (currentNode.arguments.some(isSpreadElement)) { + nodePath.skip(); + return; } + // entering assertion + const espowerOptions = Object.assign({ + path: file.opts.filename, // or opts.sourceFileName? + sourceMap: file.inputMap ? file.inputMap.toObject() : false + }, this.options); + assertionVisitor = new BabelAssertionVisitor(this.babel, patternMatcher, espowerOptions); + assertionVisitor.enter(nodePath); + file.set('espowerAssertionVisitor', assertionVisitor); + } } -}; - -BabelEspowerVisitor.prototype.exit = function (nodePath) { - var currentNode = nodePath.node; - var resultTree = currentNode; - var file = nodePath.hub.file; - var assertionVisitor = file.get('espowerAssertionVisitor'); + } + exit (nodePath) { + const currentNode = nodePath.node; + let resultTree = currentNode; + const file = nodePath.hub.file; + const assertionVisitor = file.get('espowerAssertionVisitor'); if (!assertionVisitor) { - return; + return; } if (assertionVisitor.isLeavingAssertion(nodePath)) { - // leaving assertion - assertionVisitor.leave(nodePath); - file.set('espowerAssertionVisitor', null); - return; + // leaving assertion + resultTree = assertionVisitor.leave(nodePath); + file.set('espowerAssertionVisitor', null); } if (!assertionVisitor.isCapturingArgument()) { - return; - } - if (assertionVisitor.toBeCaptured(nodePath)) { - // capturing Node - resultTree = assertionVisitor.captureNode(nodePath); + return; } if (assertionVisitor.isLeavingArgument(nodePath)) { - // capturing whole argument on leaving argument - resultTree = assertionVisitor.leaveArgument(resultTree); + // capturing whole argument on leaving argument + resultTree = assertionVisitor.leaveArgument(nodePath); + } else if (assertionVisitor.toBeCaptured(nodePath)) { + // capturing intermediate Node + resultTree = assertionVisitor.captureNode(nodePath); } if (resultTree !== currentNode) { - nodePath.replaceWith(resultTree); + nodePath.replaceWith(resultTree); } -}; - -BabelEspowerVisitor.prototype.isCalleeOfParentCallExpression = function (nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - var types = this.babel.types; - return types.isCallExpression(parentNode) && currentKey === 'callee'; -}; + } + isCalleeOfParentCallExpression ({ key, parent }) { + const types = this.babel.types; + return types.isCallExpression(parent) && key === 'callee'; + } +} module.exports = BabelEspowerVisitor; diff --git a/lib/create-espower-visitor.js b/lib/create-espower-visitor.js index 15b67c4..1730a01 100644 --- a/lib/create-espower-visitor.js +++ b/lib/create-espower-visitor.js @@ -1,32 +1,34 @@ 'use strict'; -var defaultOptions = require('./default-options'); -var assign = require('core-js/library/fn/object/assign'); -var BabelEspowerVisitor = require('./babel-espower-visitor'); +const defaultOptions = require('./default-options'); +const BabelEspowerVisitor = require('./babel-espower-visitor'); +const hasSyntaxPlugin = (pluginPass) => pluginPass.file.opts.parserOpts.plugins.length > 0; -module.exports = function createEspowerVisitor (babel, options) { - return { - visitor: { - Program: function (path) { - var opts = assign(defaultOptions(), { - astWhiteList: babel.types.BUILDER_KEYS, - visitorKeys: babel.types.VISITOR_KEYS, - sourceRoot: process.cwd() - }, options); - var espowerVisitor = new BabelEspowerVisitor(babel, opts); - var innerVisitor = Object.keys(opts.visitorKeys).reduce(function (handlers, nodeType) { - handlers[nodeType] = { - enter: function (nodePath, pluginPass) { - espowerVisitor.enter(nodePath); - }, - exit: function (nodePath, pluginPass) { - espowerVisitor.exit(nodePath); - } - }; - return handlers; - }, {}); - path.traverse(innerVisitor); +const createEspowerVisitor = (babel, options) => { + return { + visitor: { + Program (nodePath, pluginPass) { + const opts = Object.assign(defaultOptions(), { + embedAst: hasSyntaxPlugin(pluginPass), + astWhiteList: babel.types.BUILDER_KEYS, + visitorKeys: babel.types.VISITOR_KEYS, + sourceRoot: process.cwd() + }, options); + const espowerVisitor = new BabelEspowerVisitor(babel, opts); + const innerVisitor = Object.keys(opts.visitorKeys).reduce((handlers, nodeType) => { + handlers[nodeType] = { + enter (nodePath, pluginPass) { + espowerVisitor.enter(nodePath); + }, + exit (nodePath, pluginPass) { + espowerVisitor.exit(nodePath); } - } - }; + }; + return handlers; + }, {}); + nodePath.traverse(innerVisitor); + } + } + }; }; +module.exports = createEspowerVisitor; diff --git a/lib/create-node.js b/lib/create-node.js new file mode 100644 index 0000000..9e965b5 --- /dev/null +++ b/lib/create-node.js @@ -0,0 +1,80 @@ +'use strict'; + +const fs = require('fs'); +const estraverse = require('estraverse'); +const babelTemplate = require('@babel/core').template; +const loadTemplate = (filepath) => { + const templateLines = fs.readFileSync(require.resolve(filepath), 'utf8').split('\n'); + const funcBody = templateLines.slice(2, templateLines.length - 2).join('\n'); // extract template body + const ast = babelTemplate.ast(`(function () { ${funcBody} })()`); + return (cloneAst) => cloneAst(ast); +}; +const argumentRecorderTemplate = loadTemplate('./argument-recorder.js'); +const assertionMessageTemplate = loadTemplate('./assertion-message.js'); +const define = require('./define-properties'); + +const createNewArgumentRecorderNode = ({ nodePath, types, visitorKeys, metadataIdent, cloneAst, calleeNode, matchIndex }) => { + const keyName = 'ArgumentRecorder'; + const generateNode = () => { + return types.toExpression(argumentRecorderTemplate(cloneAst)); + }; + const argRecNameNode = getOrCreateNode({ nodePath, keyName, generateNode, visitorKeys }); + const recorderIdent = nodePath.scope.generateUidIdentifier('ag'); + define(recorderIdent, { _generatedByEspower: true }); + const init = types.newExpression(argRecNameNode, [ + calleeNode, + metadataIdent, + types.valueToNode(matchIndex) + ]); + define(init, { _generatedByEspower: true }); + nodePath.scope.push({ id: recorderIdent, init: init }); + return recorderIdent; +}; + +const createNewAssertionMessageNode = ({ nodePath, types, visitorKeys, metadataIdent, cloneAst, originalMessageNode = null, matchIndex = -1 }) => { + const keyName = 'AssertionMessage'; + const generateNode = () => { + return types.toExpression(assertionMessageTemplate(cloneAst)); + }; + const assertionMessageNameNode = getOrCreateNode({ nodePath, keyName, generateNode, visitorKeys }); + const newArgs = [ + metadataIdent, + types.valueToNode(matchIndex) + ]; + if (originalMessageNode) { + newArgs.push(originalMessageNode); + } + const newNode = types.newExpression(assertionMessageNameNode, newArgs); + define(newNode, { _generatedByEspower: true }); + return newNode; +}; + +const getOrCreateNode = ({ nodePath, keyName, generateNode, visitorKeys }) => { + const file = nodePath.hub.file; + // helperNameNode = file.addImport('power-assert-runtime/recorder', 'default', 'recorder'); + return file.get(keyName) || createNode({ nodePath, keyName, generateNode, visitorKeys }); +}; + +const createNode = ({ nodePath, keyName, generateNode, visitorKeys }) => { + const file = nodePath.hub.file; + const programScope = nodePath.scope.getProgramParent(); + const ident = programScope.generateUidIdentifier(keyName); + define(ident, { _generatedByEspower: true }); + file.set(keyName, ident); + const generatedNode = generateNode(); + estraverse.traverse(generatedNode, { + keys: visitorKeys, + enter: function (node) { + define(node, { _generatedByEspower: true }); + } + }); + generatedNode._compact = true; + programScope.push({ id: ident, init: generatedNode }); + return ident; +}; + +module.exports = { + createNewArgumentRecorderNode, + createNewAssertionMessageNode, + getOrCreateNode +}; diff --git a/lib/create-pattern-matchers.js b/lib/create-pattern-matchers.js new file mode 100644 index 0000000..9066435 --- /dev/null +++ b/lib/create-pattern-matchers.js @@ -0,0 +1,39 @@ +'use strict'; + +const CallMatcher = require('call-matcher'); +const babelParser = require('@babel/parser'); +const signature = require('call-signature'); +const SigMatcher = require('./sig-matcher'); + +const createPatternMatchers = (options) => { + return options.patterns.map((p, index) => { + const pattern = typeof p === 'string' ? p : p.pattern; + const parsed = signature.parse(pattern); + let matcher; + if (parsed) { + matcher = new SigMatcher(parsed); + } else { + const signatureAst = babelParser.parse(pattern); + const expression = signatureAst.program.body[0].expression; + matcher = new CallMatcher(expression, options); + } + const params = matcher.argumentSignatures().map((sig, idx) => { + if (typeof p === 'object' && p !== null && Array.isArray(p.params)) { + return Object.assign({}, sig, p.params[idx]); + } + return sig; + }); + const lastParam = params[params.length - 1]; + if (lastParam.name === 'message' && lastParam.kind === 'optional') { + lastParam.message = true; + } + return { + matcher, + index, + pattern, + params + }; + }); +}; + +module.exports = createPatternMatchers; diff --git a/lib/default-options.js b/lib/default-options.js index 968c9eb..d1e8cce 100644 --- a/lib/default-options.js +++ b/lib/default-options.js @@ -1,19 +1,88 @@ 'use strict'; -module.exports = function defaultOptions () { - return { - embedAst: true, - 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])' - ] - }; +const defaultOptions = () => { + return { + 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])', + { + pattern: 'assert.deepEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: { maxDepth: 2 } }, + { name: 'expected', options: { maxDepth: 2 } }, + { name: 'message', message: true } + ] + }, + // 'assert.notDeepEqual(actual, expected, [message])', + { + pattern: 'assert.notDeepEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: { maxDepth: 2 } }, + { name: 'expected', options: { maxDepth: 2 } }, + { name: 'message', message: true } + ] + }, + // 'assert.deepStrictEqual(actual, expected, [message])', + { + pattern: 'assert.deepStrictEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: { maxDepth: 3 } }, + { name: 'expected', options: { maxDepth: 3 } }, + { name: 'message', message: true } + ] + }, + // 'assert.notDeepStrictEqual(actual, expected, [message])', + { + pattern: 'assert.notDeepStrictEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: { maxDepth: 2 } }, + { name: 'expected', options: { maxDepth: 2 } }, + { name: 'message', message: true } + ] + }, + // 'assert.throws(block, [error], [message])', + { + pattern: 'assert.throws(fn, [error], [message])', + params: [ + { name: 'fn', block: true }, + { name: 'error', block: true }, + { name: 'message', message: true } + ] + }, + // 'assert.doesNotThrow(block, [error], [message])', + { + pattern: 'assert.doesNotThrow(fn, [error], [message])', + params: [ + { name: 'fn', block: true }, + { name: 'error', block: true }, + { name: 'message', message: true } + ] + }, + // 'assert.rejects(block, [error], [message])', + { + pattern: 'assert.rejects(asyncFn, [error], [message])', + params: [ + { name: 'asyncFn', block: true }, + { name: 'error', block: true }, + { name: 'message', message: true } + ] + }, + // 'assert.doesNotReject(block, [error], [message])' + { + pattern: 'assert.doesNotReject(asyncFn, [error], [message])', + params: [ + { name: 'asyncFn', block: true }, + { name: 'error', block: true }, + { name: 'message', message: true } + ] + } + ] + }; }; + +module.exports = defaultOptions; diff --git a/lib/define-properties.js b/lib/define-properties.js index 9f86150..7158b73 100644 --- a/lib/define-properties.js +++ b/lib/define-properties.js @@ -1,12 +1,14 @@ 'use strict'; -module.exports = function defineProperties (obj, map) { - Object.keys(map).forEach(function (name) { - Object.defineProperty(obj, name, { - configurable: true, - enumerable: false, - value: map[name], - writable: true - }); +const defineProperties = (obj, map) => { + Object.keys(map).forEach((name) => { + Object.defineProperty(obj, name, { + configurable: true, + enumerable: false, + value: map[name], + writable: true }); + }); }; + +module.exports = defineProperties; diff --git a/lib/power-assert-recorder.js b/lib/power-assert-recorder.js deleted file mode 100644 index 0e59999..0000000 --- a/lib/power-assert-recorder.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; -module.exports = /* intentional newline */ - function () { - function PowerAssertRecorder() { - this.captured = []; - } - - PowerAssertRecorder.prototype._capt = function _capt (value, espath) { - this.captured.push({value: value, espath: espath}); - return value; - }; - - PowerAssertRecorder.prototype._expr = function _expr (value, source) { - var capturedValues = this.captured; - this.captured = []; - return { - powerAssertContext: { - value: value, - events: capturedValues - }, - source: source - }; - }; - - return PowerAssertRecorder; -} diff --git a/lib/sig-matcher.js b/lib/sig-matcher.js new file mode 100644 index 0000000..f0e86db --- /dev/null +++ b/lib/sig-matcher.js @@ -0,0 +1,74 @@ +'use strict'; + +const isIdentifier = (node) => node && node.type === 'Identifier'; +const isCallExpression = (node) => node && node.type === 'CallExpression'; +const hasIdentName = (node, name) => isIdentifier(node) && node.name === name; +const isCalleeOfParent = (currentNode, parentNode) => parentNode && + currentNode && + parentNode.type === 'CallExpression' && + parentNode.callee === currentNode; + +class SigMatcher { + constructor ({ callee, args }) { + this.callee = callee; + this.args = args; + this.numMaxArgs = args.length; + this.numMinArgs = args.filter((a) => a.optional === false).length; + } + test (currentNode) { + if (this.isCalleeMatched(currentNode)) { + const numArgs = currentNode.arguments.length; + return this.numMinArgs <= numArgs && numArgs <= this.numMaxArgs; + } + return false; + } + matchArgument (currentNode, parentNode) { + if (isCalleeOfParent(currentNode, parentNode)) { + return null; + } + if (this.test(parentNode)) { + const indexOfCurrentArg = parentNode.arguments.indexOf(currentNode); + let numOptional = parentNode.arguments.length - this.numMinArgs; + const matchedSignatures = this.argumentSignatures().reduce((accum, argSig) => { + if (argSig.kind === 'mandatory') { + accum.push(argSig); + } + if (argSig.kind === 'optional' && numOptional > 0) { + numOptional -= 1; + accum.push(argSig); + } + return accum; + }, []); + return matchedSignatures[indexOfCurrentArg]; + } + return null; + } + argumentSignatures () { + return this.args.map(toArgumentSignature); + } + isCalleeMatched (currentNode) { + if (!isCallExpression(currentNode)) { + return false; + } + const callee = currentNode.callee; + switch (this.callee.type) { + case 'Identifier': + return hasIdentName(callee, this.callee.name); + case 'MemberExpression': + const memObj = callee.object; + const memProp = callee.property; + return hasIdentName(memObj, this.callee.object) && hasIdentName(memProp, this.callee.member); + default: + return false; + } + } +} +const toArgumentSignature = (arg, idx) => { + return { + index: idx, + name: arg.name, + kind: arg.optional ? 'optional' : 'mandatory' + }; +}; + +module.exports = SigMatcher; diff --git a/lib/to-be-captured.js b/lib/to-be-captured.js index 248fe53..5bc4cf6 100644 --- a/lib/to-be-captured.js +++ b/lib/to-be-captured.js @@ -1,56 +1,34 @@ 'use strict'; -var typesToBeCaptured = [ - 'Identifier', - 'BinaryExpression', - 'MemberExpression', - 'CallExpression', - 'UnaryExpression', - 'LogicalExpression', - 'ArrayExpression', - 'ObjectExpression', - 'TemplateLiteral', - 'YieldExpression', - 'AwaitExpression', - 'NewExpression', - 'AssignmentExpression', - 'UpdateExpression', - 'TaggedTemplateExpression' +const typesToBeCaptured = [ + 'Identifier', + 'BinaryExpression', + 'MemberExpression', + 'CallExpression', + 'UnaryExpression', + 'LogicalExpression', + 'ArrayExpression', + 'ObjectExpression', + 'TemplateLiteral', + 'YieldExpression', + 'AwaitExpression', + 'NewExpression', + 'AssignmentExpression', + 'UpdateExpression', + 'TaggedTemplateExpression' ]; -function isCaputuringTargetType (types, nodePath) { - var currentNode = nodePath.node; - return typesToBeCaptured.some(function (nodeType) { - return types['is' + nodeType](currentNode); - }); -} +module.exports = (types) => { + const isCaputuringTargetType = ({ node }) => node && typesToBeCaptured.includes(node.type); + const isCalleeOfParent = ({ key, parent }) => (types.isCallExpression(parent) || types.isNewExpression(parent)) && key === 'callee'; + const isChildOfTaggedTemplateExpression = ({ parent }) => types.isTaggedTemplateExpression(parent); -function isCalleeOfParent(types, nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - return (types.isCallExpression(parentNode) || types.isNewExpression(parentNode)) && currentKey === 'callee'; -} - -function isChildOfTaggedTemplateExpression(types, nodePath) { - var parentNode = nodePath.parent; - return types.isTaggedTemplateExpression(parentNode); -} - -function isYieldOrAwaitArgument(types, nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - // capture the yielded/await result, not the promise - return (types.isYieldExpression(parentNode) || types.isAwaitExpression(parentNode)) && currentKey === 'argument'; -} - -var blacklist = [ - isYieldOrAwaitArgument, + const blacklist = [ isCalleeOfParent, isChildOfTaggedTemplateExpression -]; + ]; -module.exports = function toBeCaptured (types, nodePath) { - return isCaputuringTargetType(types, nodePath) && !blacklist.some(function (predicate) { - return predicate(types, nodePath); - }); + return (nodePath) => { + return isCaputuringTargetType(nodePath) && !blacklist.some((pred) => pred(nodePath)); + }; }; diff --git a/lib/to-be-skipped.js b/lib/to-be-skipped.js index 4877eff..b766cd9 100644 --- a/lib/to-be-skipped.js +++ b/lib/to-be-skipped.js @@ -1,105 +1,68 @@ 'use strict'; -var typesNotToBeSkippedDuringCapturing = [ - 'Identifier', - 'BinaryExpression', - 'MemberExpression', - 'CallExpression', - 'UnaryExpression', - 'LogicalExpression', - 'ArrayExpression', - 'ObjectExpression', - 'SequenceExpression', - 'TemplateLiteral', - 'YieldExpression', - 'AwaitExpression', - 'NewExpression', - 'AssignmentExpression', - 'UpdateExpression', - 'TaggedTemplateExpression', - 'ConditionalExpression', - 'SpreadElement', - 'Property' +const typesNotToBeSkippedDuringCapturing = [ + 'Identifier', + 'BinaryExpression', + 'MemberExpression', + 'CallExpression', + 'UnaryExpression', + 'LogicalExpression', + 'ArrayExpression', + 'ObjectExpression', + 'SequenceExpression', + 'TemplateLiteral', + 'YieldExpression', + 'AwaitExpression', + 'NewExpression', + 'AssignmentExpression', + 'UpdateExpression', + 'TaggedTemplateExpression', + 'ConditionalExpression', + 'SpreadElement', + 'ObjectProperty' ]; +const isTypeNotToBeSkippedDuringCapturing = ({ node }) => node && typesNotToBeSkippedDuringCapturing.includes(node.type); +const isTypeToBeSkippedDuringCapturing = (nodePath) => !isTypeNotToBeSkippedDuringCapturing(nodePath); -function isTypeNotToBeSkippedDuringCapturing (types, nodePath) { - var currentNode = nodePath.node; - return typesNotToBeSkippedDuringCapturing.some(function (nodeType) { - return types['is' + nodeType](currentNode); - }); -} +module.exports = (types) => { + const isChildOfObjectLiteral = (parent) => types.isObjectProperty(parent) || types.isObjectMethod(parent); + const isObjectLiteralKey = (parent, key) => isChildOfObjectLiteral(parent) && key === 'key'; + const isObjectLiteralValue = (parent, key) => isChildOfObjectLiteral(parent) && key === 'value'; -function isTypeToBeSkippedDuringCapturing (types, nodePath) { - return !isTypeNotToBeSkippedDuringCapturing(types, nodePath); -} + // Do not instrument left due to 'Invalid left-hand side in assignment' + const isLeftHandSideOfAssignment = ({ key, parent }) => types.isAssignmentExpression(parent) && key === 'left'; -function isLeftHandSideOfAssignment(types, nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - // Do not instrument left due to 'Invalid left-hand side in assignment' - return types.isAssignmentExpression(parentNode) && currentKey === 'left'; -} + // Do not instrument non-computed Object literal key + const isNonComputedObjectLiteralKey = ({ key, parent }) => isObjectLiteralKey(parent, key) && !parent.computed; -function isChildOfObjectLiteral (types, parentNode) { - return types.isObjectProperty(parentNode) || types.isObjectMethod(parentNode); -} + // Do not instrument shorthanded Object literal value + const isShorthandedValueOfObjectLiteral = ({ key, parent }) => isObjectLiteralValue(parent, key) && parent.shorthand; -function isObjectLiteralKey (types, parentNode, currentKey) { - return isChildOfObjectLiteral(types, parentNode) && currentKey === 'key'; -} + // Just wrap UpdateExpression, not digging in. + const isUpdateExpression = ({ parent }) => types.isUpdateExpression(parent); -function isObjectLiteralValue (types, parentNode, currentKey) { - return isChildOfObjectLiteral(types, parentNode) && currentKey === 'value'; -} + // Do not instrument non-computed property of MemberExpression within CallExpression. + const isCallExpressionWithNonComputedMemberExpression = ({ key, node, parent }) => { + return types.isIdentifier(node) && types.isMemberExpression(parent) && !parent.computed && key === 'property'; + }; -function isNonComputedObjectLiteralKey(types, nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - // Do not instrument non-computed Object literal key - return isObjectLiteralKey(types, parentNode, currentKey) && !parentNode.computed; -} + // 'typeof Identifier' or 'delete Identifier' is not instrumented + const isTypeOfOrDeleteUnaryExpression = ({ key, node, parent }) => { + return types.isIdentifier(node) && types.isUnaryExpression(parent) && + (parent.operator === 'typeof' || parent.operator === 'deletey') && key === 'argument'; + }; -function isShorthandedValueOfObjectLiteral(types, nodePath) { - var currentKey = nodePath.key; - var parentNode = nodePath.parent; - // Do not instrument shorthanded Object literal value - return isObjectLiteralValue(types, parentNode, currentKey) && parentNode.shorthand; -} - -function isUpdateExpression(types, nodePath) { - var parentNode = nodePath.parent; - // Just wrap UpdateExpression, not digging in. - return types.isUpdateExpression(parentNode); -} - -function isCallExpressionWithNonComputedMemberExpression(types, nodePath) { - var currentKey = nodePath.key; - var currentNode = nodePath.node; - var parentNode = nodePath.parent; - // Do not instrument non-computed property of MemberExpression within CallExpression. - return types.isIdentifier(currentNode) && types.isMemberExpression(parentNode) && !parentNode.computed && currentKey === 'property'; -} - -function isTypeOfOrDeleteUnaryExpression(types, nodePath) { - var currentKey = nodePath.key; - var currentNode = nodePath.node; - var parentNode = nodePath.parent; - // 'typeof Identifier' or 'delete Identifier' is not instrumented - return types.isIdentifier(currentNode) && types.isUnaryExpression(parentNode) && (parentNode.operator === 'typeof' || parentNode.operator === 'delete') && currentKey === 'argument'; -} - -var criteriaForSkipping = [ + const criteriaForSkipping = [ isTypeToBeSkippedDuringCapturing, isLeftHandSideOfAssignment, isNonComputedObjectLiteralKey, isShorthandedValueOfObjectLiteral, isUpdateExpression, isCallExpressionWithNonComputedMemberExpression, - isTypeOfOrDeleteUnaryExpression, -]; + isTypeOfOrDeleteUnaryExpression + ]; -module.exports = function toBeSkipped (types, nodePath) { - return criteriaForSkipping.some(function (predicate) { - return predicate(types, nodePath); - }); + return (nodePath) => { + return criteriaForSkipping.some((pred) => pred(nodePath)); + }; }; diff --git a/package-lock.json b/package-lock.json index d6c232e..5050b0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,35 +14,35 @@ } }, "@babel/core": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.2.2.tgz", - "integrity": "sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.4.tgz", + "integrity": "sha512-lQgGX3FPRgbz2SKmhMtYgJvVzGZrmjaF4apZ2bLwofAKiSjxU0drPh4S/VasyYXwaTs+A1gvQ45BN8SQJzHsQQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.2.2", - "@babel/helpers": "^7.2.0", - "@babel/parser": "^7.2.2", - "@babel/template": "^7.2.2", - "@babel/traverse": "^7.2.2", - "@babel/types": "^7.2.2", + "@babel/generator": "^7.4.4", + "@babel/helpers": "^7.4.4", + "@babel/parser": "^7.4.4", + "@babel/template": "^7.4.4", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" } }, "@babel/generator": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.2.2.tgz", - "integrity": "sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", + "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", "requires": { - "@babel/types": "^7.2.2", + "@babel/types": "^7.4.4", "jsesc": "^2.5.1", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "source-map": "^0.5.0", "trim-right": "^1.0.1" } @@ -67,35 +67,35 @@ } }, "@babel/helper-builder-react-jsx": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.0.0.tgz", - "integrity": "sha512-ebJ2JM6NAKW0fQEqN8hOLxK84RbRz9OkUhGS/Xd5u56ejMfVbayJ4+LykERZCOUM6faa6Fp3SZNX3fcT16MKHw==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz", + "integrity": "sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw==", "dev": true, "requires": { - "@babel/types": "^7.0.0", + "@babel/types": "^7.3.0", "esutils": "^2.0.0" } }, "@babel/helper-call-delegate": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.1.0.tgz", - "integrity": "sha512-YEtYZrw3GUK6emQHKthltKNZwszBcHK58Ygcis+gVUrF4/FmTVr5CCqQNSfmvg2y+YDEANyYoaLz/SHsnusCwQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz", + "integrity": "sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.0.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-hoist-variables": "^7.4.4", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" } }, "@babel/helper-define-map": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz", - "integrity": "sha512-yPPcW8dc3gZLN+U1mhYV91QU3n5uTbx7DUdf8NnPbjS0RMwBuHi9Xt2MUgppmNz7CJxTBWsGczTiEp1CSOTPRg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz", + "integrity": "sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg==", "dev": true, "requires": { "@babel/helper-function-name": "^7.1.0", - "@babel/types": "^7.0.0", - "lodash": "^4.17.10" + "@babel/types": "^7.4.4", + "lodash": "^4.17.11" } }, "@babel/helper-explode-assignable-expression": { @@ -129,12 +129,12 @@ } }, "@babel/helper-hoist-variables": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz", - "integrity": "sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz", + "integrity": "sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.4.4" } }, "@babel/helper-member-expression-to-functions": { @@ -156,17 +156,17 @@ } }, "@babel/helper-module-transforms": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.2.2.tgz", - "integrity": "sha512-YRD7I6Wsv+IHuTPkAmAS4HhY0dkPobgLftHp0cRGZSdrRvmZY8rFvae/GVu3bD00qscuvK3WPHB3YdNpBXUqrA==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz", + "integrity": "sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/template": "^7.2.2", - "@babel/types": "^7.2.2", - "lodash": "^4.17.10" + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/template": "^7.4.4", + "@babel/types": "^7.4.4", + "lodash": "^4.17.11" } }, "@babel/helper-optimise-call-expression": { @@ -185,12 +185,12 @@ "dev": true }, "@babel/helper-regex": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0.tgz", - "integrity": "sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.4.4.tgz", + "integrity": "sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q==", "dev": true, "requires": { - "lodash": "^4.17.10" + "lodash": "^4.17.11" } }, "@babel/helper-remap-async-to-generator": { @@ -207,15 +207,15 @@ } }, "@babel/helper-replace-supers": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.2.3.tgz", - "integrity": "sha512-GyieIznGUfPXPWu0yLS6U55Mz67AZD9cUk0BfirOWlPrXlBcan9Gz+vHGz+cPfuoweZSnPzPIm67VtQM0OWZbA==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz", + "integrity": "sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg==", "dev": true, "requires": { "@babel/helper-member-expression-to-functions": "^7.0.0", "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.2.3", - "@babel/types": "^7.0.0" + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" } }, "@babel/helper-simple-access": { @@ -229,12 +229,12 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", - "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", + "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", "dev": true, "requires": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.4.4" } }, "@babel/helper-wrap-function": { @@ -250,14 +250,14 @@ } }, "@babel/helpers": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.2.0.tgz", - "integrity": "sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.4.tgz", + "integrity": "sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A==", "dev": true, "requires": { - "@babel/template": "^7.1.2", - "@babel/traverse": "^7.1.5", - "@babel/types": "^7.2.0" + "@babel/template": "^7.4.4", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" } }, "@babel/highlight": { @@ -272,9 +272,9 @@ } }, "@babel/parser": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.2.3.tgz", - "integrity": "sha512-0LyEcVlfCoFmci8mXx8A5oIkpkOgyo8dRHtxBnK9RRBwxO2+JZPNsqtVEZQ7mJFPxnXF9lfmU24mHOPI0qnlkA==" + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", + "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==" }, "@babel/plugin-proposal-async-generator-functions": { "version": "7.2.0", @@ -298,9 +298,9 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.2.0.tgz", - "integrity": "sha512-1L5mWLSvR76XYUQJXkd/EEQgjq8HHRP6lQuZTTg0VA4tTGPpGemmCdAfQIz1rzEuWAm+ecP8PyyEm30jC1eQCg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.4.tgz", + "integrity": "sha512-dMBG6cSPBbHeEBdFXeQ2QLc5gUpg4Vkaz8octD4aoW/ISO+jBOcsuxYL7bsb5WSu8RLP6boxrBIALEHgoHtO9g==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -318,14 +318,14 @@ } }, "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.2.0.tgz", - "integrity": "sha512-LvRVYb7kikuOtIoUeWTkOxQEV1kYvL5B6U3iWEGCzPNRus1MzJweFqORTj+0jkxozkTSYNJozPOddxmqdqsRpw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz", + "integrity": "sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.0.0", - "regexpu-core": "^4.2.0" + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" } }, "@babel/plugin-syntax-async-generators": { @@ -383,9 +383,9 @@ } }, "@babel/plugin-transform-async-to-generator": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.2.0.tgz", - "integrity": "sha512-CEHzg4g5UraReozI9D4fblBYABs7IM6UerAVG7EJVrTLC5keh00aEuLUT+O40+mJCEzaXkYfTCUKIyeDfMOFFQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.4.tgz", + "integrity": "sha512-YiqW2Li8TXmzgbXw+STsSqPBPFnGviiaSp6CYOq55X8GQ2SGVLrXB6pNid8HkqkZAzOH6knbai3snhP7v0fNwA==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -403,28 +403,28 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.2.0.tgz", - "integrity": "sha512-vDTgf19ZEV6mx35yiPJe4fS02mPQUUcBNwWQSZFXSzTSbsJFQvHt7DqyS3LK8oOWALFOsJ+8bbqBgkirZteD5Q==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz", + "integrity": "sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "lodash": "^4.17.10" + "lodash": "^4.17.11" } }, "@babel/plugin-transform-classes": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz", - "integrity": "sha512-gEZvgTy1VtcDOaQty1l10T3jQmJKlNVxLDCs+3rCVPr6nMkODLELxViq5X9l+rfxbie3XrfrMCYYY6eX3aOcOQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz", + "integrity": "sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-define-map": "^7.1.0", + "@babel/helper-define-map": "^7.4.4", "@babel/helper-function-name": "^7.1.0", "@babel/helper-optimise-call-expression": "^7.0.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", + "@babel/helper-replace-supers": "^7.4.4", + "@babel/helper-split-export-declaration": "^7.4.4", "globals": "^11.1.0" } }, @@ -438,23 +438,23 @@ } }, "@babel/plugin-transform-destructuring": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.2.0.tgz", - "integrity": "sha512-coVO2Ayv7g0qdDbrNiadE4bU7lvCd9H539m2gMknyVjjMdwF/iCOM7R+E8PkntoqLkltO0rk+3axhpp/0v68VQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.4.tgz", + "integrity": "sha512-/aOx+nW0w8eHiEHm+BTERB2oJn5D127iye/SUQl7NjHy0lf+j7h4MKMMSOwdazGq9OxgiNADncE+SRJkCxjZpQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-dotall-regex": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz", - "integrity": "sha512-sKxnyHfizweTgKZf7XsXu/CNupKhzijptfTM+bozonIuyVrLWVUvYjE2bhuSBML8VQeMxq4Mm63Q9qvcvUcciQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz", + "integrity": "sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.0.0", - "regexpu-core": "^4.1.3" + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" } }, "@babel/plugin-transform-duplicate-keys": { @@ -477,18 +477,18 @@ } }, "@babel/plugin-transform-for-of": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.2.0.tgz", - "integrity": "sha512-Kz7Mt0SsV2tQk6jG5bBv5phVbkd0gd27SgYD4hH1aLMJRchM0dzHaXvrWhVZ+WxAlDoAKZ7Uy3jVTW2mKXQ1WQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz", + "integrity": "sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-function-name": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.2.0.tgz", - "integrity": "sha512-kWgksow9lHdvBC2Z4mxTsvc7YdY7w/V6B2vy9cTIPtLEE9NhwoWivaxdNM/S37elu5bqlLP/qOY906LukO9lkQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz", + "integrity": "sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA==", "dev": true, "requires": { "@babel/helper-function-name": "^7.1.0", @@ -504,6 +504,15 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz", + "integrity": "sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-transform-modules-amd": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz", @@ -515,23 +524,23 @@ } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz", - "integrity": "sha512-V6y0uaUQrQPXUrmj+hgnks8va2L0zcZymeU7TtWEgdRLNkceafKXEduv7QzgQAE4lT+suwooG9dC7LFhdRAbVQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.4.tgz", + "integrity": "sha512-4sfBOJt58sEo9a2BQXnZq+Q3ZTSAUXyK3E30o36BOGnJ+tvJ6YSxF0PG6kERvbeISgProodWuI9UVG3/FMY6iw==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-module-transforms": "^7.4.4", "@babel/helper-plugin-utils": "^7.0.0", "@babel/helper-simple-access": "^7.1.0" } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.2.0.tgz", - "integrity": "sha512-aYJwpAhoK9a+1+O625WIjvMY11wkB/ok0WClVwmeo3mCjcNRjt+/8gHWrB5i+00mUju0gWsBkQnPpdvQ7PImmQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.4.tgz", + "integrity": "sha512-MSiModfILQc3/oqnG7NrP1jHaSPryO6tA2kOMmAQApz5dayPxWiHqmq4sWH2xF5LcQK56LlbKByCd8Aah/OIkQ==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.0.0", + "@babel/helper-hoist-variables": "^7.4.4", "@babel/helper-plugin-utils": "^7.0.0" } }, @@ -545,10 +554,19 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.4.tgz", + "integrity": "sha512-Ki+Y9nXBlKfhD+LXaRS7v95TtTGYRAf9Y1rTDiE75zf8YQz4GDaWRXosMfJBXxnk88mGFjWdCRIeqDbon7spYA==", + "dev": true, + "requires": { + "regexp-tree": "^0.1.0" + } + }, "@babel/plugin-transform-new-target": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz", - "integrity": "sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz", + "integrity": "sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -565,16 +583,25 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz", - "integrity": "sha512-kB9+hhUidIgUoBQ0MsxMewhzr8i60nMa2KgeJKQWYrqQpqcBYtnpR+JgkadZVZoaEZ/eKu9mclFaVwhRpLNSzA==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz", + "integrity": "sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw==", "dev": true, "requires": { - "@babel/helper-call-delegate": "^7.1.0", + "@babel/helper-call-delegate": "^7.4.4", "@babel/helper-get-function-arity": "^7.0.0", "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-transform-property-literals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz", + "integrity": "sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-transform-react-display-name": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz", @@ -585,12 +612,12 @@ } }, "@babel/plugin-transform-react-jsx": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.2.0.tgz", - "integrity": "sha512-h/fZRel5wAfCqcKgq3OhbmYaReo7KkoJBpt8XnvpS7wqaNMqtw5xhxutzcm35iMUWucfAdT/nvGTsWln0JTg2Q==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz", + "integrity": "sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg==", "dev": true, "requires": { - "@babel/helper-builder-react-jsx": "^7.0.0", + "@babel/helper-builder-react-jsx": "^7.3.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-syntax-jsx": "^7.2.0" } @@ -616,12 +643,21 @@ } }, "@babel/plugin-transform-regenerator": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz", - "integrity": "sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.4.tgz", + "integrity": "sha512-Zz3w+pX1SI0KMIiqshFZkwnVGUhDZzpX2vtPzfJBKQQq8WsP/Xy9DNdELWivxcKOCX/Pywge4SiEaPaLtoDT4g==", "dev": true, "requires": { - "regenerator-transform": "^0.13.3" + "regenerator-transform": "^0.13.4" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz", + "integrity": "sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-shorthand-properties": { @@ -653,9 +689,9 @@ } }, "@babel/plugin-transform-template-literals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.2.0.tgz", - "integrity": "sha512-FkPix00J9A/XWXv4VoKJBMeSkyY9x/TqIh76wzcdfl57RJJcf8CehQ08uwfhCDNtRQYtHQKBTwKZDEyjE13Lwg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz", + "integrity": "sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.0.0", @@ -672,63 +708,70 @@ } }, "@babel/plugin-transform-unicode-regex": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.2.0.tgz", - "integrity": "sha512-m48Y0lMhrbXEJnVUaYly29jRXbQ3ksxPrS1Tg8t+MHqzXhtBYAvI51euOBaoAlZLPHsieY9XPVMf80a5x0cPcA==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz", + "integrity": "sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.0.0", - "regexpu-core": "^4.1.3" + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.5.4" } }, "@babel/preset-env": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.3.tgz", - "integrity": "sha512-AuHzW7a9rbv5WXmvGaPX7wADxFkZIqKlbBh1dmZUQp4iwiPpkE/Qnrji6SC4UQCQzvWY/cpHET29eUhXS9cLPw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.4.4.tgz", + "integrity": "sha512-FU1H+ACWqZZqfw1x2G1tgtSSYSfxJLkpaUQL37CenULFARDo+h4xJoVHzRoHbK+85ViLciuI7ME4WTIhFRBBlw==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-proposal-async-generator-functions": "^7.2.0", "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.2.0", + "@babel/plugin-proposal-object-rest-spread": "^7.4.4", "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.2.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", "@babel/plugin-syntax-async-generators": "^7.2.0", + "@babel/plugin-syntax-json-strings": "^7.2.0", "@babel/plugin-syntax-object-rest-spread": "^7.2.0", "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.2.0", + "@babel/plugin-transform-async-to-generator": "^7.4.4", "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.2.0", - "@babel/plugin-transform-classes": "^7.2.0", + "@babel/plugin-transform-block-scoping": "^7.4.4", + "@babel/plugin-transform-classes": "^7.4.4", "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.2.0", - "@babel/plugin-transform-dotall-regex": "^7.2.0", + "@babel/plugin-transform-destructuring": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", "@babel/plugin-transform-duplicate-keys": "^7.2.0", "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-for-of": "^7.2.0", - "@babel/plugin-transform-function-name": "^7.2.0", + "@babel/plugin-transform-for-of": "^7.4.4", + "@babel/plugin-transform-function-name": "^7.4.4", "@babel/plugin-transform-literals": "^7.2.0", + "@babel/plugin-transform-member-expression-literals": "^7.2.0", "@babel/plugin-transform-modules-amd": "^7.2.0", - "@babel/plugin-transform-modules-commonjs": "^7.2.0", - "@babel/plugin-transform-modules-systemjs": "^7.2.0", + "@babel/plugin-transform-modules-commonjs": "^7.4.4", + "@babel/plugin-transform-modules-systemjs": "^7.4.4", "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-new-target": "^7.0.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.4", + "@babel/plugin-transform-new-target": "^7.4.4", "@babel/plugin-transform-object-super": "^7.2.0", - "@babel/plugin-transform-parameters": "^7.2.0", - "@babel/plugin-transform-regenerator": "^7.0.0", + "@babel/plugin-transform-parameters": "^7.4.4", + "@babel/plugin-transform-property-literals": "^7.2.0", + "@babel/plugin-transform-regenerator": "^7.4.4", + "@babel/plugin-transform-reserved-words": "^7.2.0", "@babel/plugin-transform-shorthand-properties": "^7.2.0", "@babel/plugin-transform-spread": "^7.2.0", "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.2.0", + "@babel/plugin-transform-template-literals": "^7.4.4", "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.2.0", - "browserslist": "^4.3.4", + "@babel/plugin-transform-unicode-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "browserslist": "^4.5.2", + "core-js-compat": "^3.0.0", "invariant": "^2.2.2", "js-levenshtein": "^1.1.3", - "semver": "^5.3.0" + "semver": "^5.5.0" } }, "@babel/preset-react": { @@ -745,43 +788,85 @@ } }, "@babel/template": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", - "integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", + "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.2.2", - "@babel/types": "^7.2.2" + "@babel/parser": "^7.4.4", + "@babel/types": "^7.4.4" } }, "@babel/traverse": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", - "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.4.tgz", + "integrity": "sha512-Gw6qqkw/e6AGzlyj9KnkabJX7VcubqPtkUQVAwkc0wUMldr3A/hezNB3Rc5eIvId95iSGkGIOe5hh1kMKf951A==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.2.2", + "@babel/generator": "^7.4.4", "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.2.3", - "@babel/types": "^7.2.2", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/parser": "^7.4.4", + "@babel/types": "^7.4.4", "debug": "^4.1.0", "globals": "^11.1.0", - "lodash": "^4.17.10" + "lodash": "^4.17.11" } }, "@babel/types": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.2.tgz", - "integrity": "sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", + "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", "requires": { "esutils": "^2.0.2", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "to-fast-properties": "^2.0.0" } }, + "acorn": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", + "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", + "integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==", + "dev": true + }, + "ajv": { + "version": "6.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.0.tgz", + "integrity": "sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw==", + "dev": true + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -791,6 +876,78 @@ "color-convert": "^1.9.0" } }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" + } + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -814,31 +971,56 @@ "dev": true }, "browserslist": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.7.tgz", - "integrity": "sha512-pWQv51Ynb0MNk9JGMCZ8VkM785/4MQNXiFYtPqI7EEP0TJO+/d/NqRVn1uiAN0DNbnlUSpL2sh16Kspasv3pUQ==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.0.tgz", + "integrity": "sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000925", - "electron-to-chromium": "^1.3.96", - "node-releases": "^1.1.3" + "caniuse-lite": "^1.0.30000967", + "electron-to-chromium": "^1.3.133", + "node-releases": "^1.1.19" } }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "call-matcher": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/call-matcher/-/call-matcher-1.1.0.tgz", - "integrity": "sha512-IoQLeNwwf9KTNbtSA7aEBb1yfDbdnzwjCetjkC8io5oGeOmK2CBNdg0xr+tadRYKO0p7uQyZzvon0kXlZbvGrw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/call-matcher/-/call-matcher-2.0.0.tgz", + "integrity": "sha512-CIDC5wZZfZ2VjZu849WQckS58Z3pJXFfRaSjNjgo/q3in5zxkhTwVL83vttgtmvyLG7TuDlLlBya7SKP6CjDIA==", "requires": { - "core-js": "^2.0.0", "deep-equal": "^1.0.0", - "espurify": "^1.6.0", + "espurify": "^2.0.0", "estraverse": "^4.0.0" } }, + "call-signature": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/call-signature/-/call-signature-0.0.2.tgz", + "integrity": "sha1-qEq8glpV70yysCi9dOIFpluaSZY=" + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "^0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, "caniuse-lite": { - "version": "1.0.30000927", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000927.tgz", - "integrity": "sha512-ogq4NbUWf1uG/j66k0AmiO3GjqJAlQyF8n4w8a954cbCyFKmYGvRtgz6qkq2fWuduTXHibX7GyYL5Pg58Aks2g==", + "version": "1.0.30000969", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000969.tgz", + "integrity": "sha512-Kus0yxkoAJgVc0bax7S4gLSlFifCa7MnSZL9p9VuS/HIKEL4seaqh28KIQAAO50cD/rJ5CiJkJFapkdDAlhFxQ==", "dev": true }, "chalk": { @@ -852,6 +1034,33 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -879,6 +1088,50 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "convert-source-map": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", @@ -888,10 +1141,49 @@ "safe-buffer": "~5.1.1" } }, - "core-js": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.1.tgz", - "integrity": "sha512-L72mmmEayPJBejKIWe2pYtGis5r0tQ5NaJekdhyXgeMQTpJoBsH0NL4ElY2LfSoV15xeQWKQ+XTTOZdyero5Xg==" + "core-js-compat": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.1.1.tgz", + "integrity": "sha512-RH3kv8NFovFRMdeTEUgu8nMquEWKEVttOY3JFi8mN75sg72zygPqWbpWNTUw4JYEU43562tlzhdWsWqXmdFAnQ==", + "dev": true, + "requires": { + "browserslist": "^4.6.0", + "core-js-pure": "3.1.1", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz", + "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==", + "dev": true + } + } + }, + "core-js-pure": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.1.1.tgz", + "integrity": "sha512-jH3ZJ0CJ0wwDvWY0olbOComLo6tbWg4kE2x0j4+wlqYnofwF9mYm98YvADuENUzGw69IddmWFCF1FQ2S0jP96A==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } }, "debug": { "version": "4.1.1", @@ -902,109 +1194,620 @@ "ms": "^2.1.1" } }, + "debug-log": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", + "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", + "dev": true + }, "deep-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "deglob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/deglob/-/deglob-3.1.0.tgz", + "integrity": "sha512-al10l5QAYaM/PeuXkAr1Y9AQz0LCtWsnJG23pIgh44hDxHFOj36l6qvhfjnIWBYwZOqM1fXUFV9tkjL7JPdGvw==", + "dev": true, + "requires": { + "find-root": "^1.0.0", + "glob": "^7.0.5", + "ignore": "^5.0.0", + "pkg-config": "^1.1.0", + "run-parallel": "^1.1.2", + "uniq": "^1.0.1" + }, + "dependencies": { + "ignore": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.1.tgz", + "integrity": "sha512-DWjnQIFLenVrwyRCKZT+7a7/U4Cqgar4WG8V++K3hw+lrW1hc/SIwdiGmtxKCVACmHULTuGeBbHJmbwW7/sAvA==", + "dev": true + } + } + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, - "electron-to-chromium": { - "version": "1.3.100", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.100.tgz", - "integrity": "sha512-cEUzis2g/RatrVf8x26L8lK5VEls1AGnLHk6msluBUg/NTB4wcXzExTsGscFq+Vs4WBBU2zbLLySvD4C0C3hwg==", - "dev": true + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "electron-to-chromium": { + "version": "1.3.135", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.135.tgz", + "integrity": "sha512-xXLNstRdVsisPF3pL3H9TVZo2XkMILfqtD6RiWIUmDK2sFX1Bjwqmd8LBp0Kuo2FgKO63JXPoEVGm8WyYdwP0Q==", "dev": true }, - "espower-location-detector": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/espower-location-detector/-/espower-location-detector-1.0.0.tgz", - "integrity": "sha1-oXt+zFnTDheeK+9z+0E3cEyzMbU=", + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, "requires": { - "is-url": "^1.2.1", - "path-is-absolute": "^1.0.0", - "source-map": "^0.5.0", - "xtend": "^4.0.0" + "is-arrayish": "^0.2.1" } }, - "espurify": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/espurify/-/espurify-1.8.1.tgz", - "integrity": "sha512-ZDko6eY/o+D/gHCWyHTU85mKDgYcS4FJj7S+YD6WIInm7GQ6AnOjmcL4+buFV/JOztVLELi/7MmuGU5NHta0Mg==", + "es-abstract": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", + "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "dev": true, "requires": { - "core-js": "^2.0.0" + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-keys": "^1.0.12" } }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" } }, - "globals": { - "version": "11.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.9.0.tgz", - "integrity": "sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg==", + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "eslint": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", + "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "dev": true, + "requires": { + "ajv": "^6.5.0", + "babel-code-frame": "^6.26.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "doctrine": "^2.1.0", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^4.0.0", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.7.0", + "ignore": "^4.0.2", + "imurmurhash": "^0.1.4", + "inquirer": "^5.2.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.11.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.5", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "pluralize": "^7.0.0", + "progress": "^2.0.0", + "regexpp": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.5.0", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^4.0.3", + "text-table": "^0.2.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-config-semistandard": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-semistandard/-/eslint-config-semistandard-13.0.0.tgz", + "integrity": "sha512-ZuImKnf/9LeZjr6dtRJ0zEdQbjBwXu0PJR3wXJXoQeMooICMrYPyD70O1tIA9Ng+wutgLjB7UXvZOKYPvzHg+w==", "dev": true }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "eslint-config-standard": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz", + "integrity": "sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==", "dev": true }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "eslint-config-standard-jsx": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-6.0.2.tgz", + "integrity": "sha512-D+YWAoXw+2GIdbMBRAzWwr1ZtvnSf4n4yL0gKGg7ShUOGXkSOLerI17K4F6LdQMJPNMoWYqepzQD/fKY+tXNSg==", "dev": true }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "eslint-import-resolver-node": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", "dev": true, "requires": { - "once": "^1.3.0", + "debug": "^2.6.9", + "resolve": "^1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz", + "integrity": "sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw==", + "dev": true, + "requires": { + "debug": "^2.6.8", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-es": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz", + "integrity": "sha512-XfFmgFdIUDgvaRAlaXUkxrRg5JSADoRC8IkKLc/cISeR3yHVMefFHQZpcyXXEUUPHfy5DwviBcrfqlyqEwlQVw==", + "dev": true, + "requires": { + "eslint-utils": "^1.3.0", + "regexpp": "^2.0.1" + } + }, + "eslint-plugin-import": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", + "dev": true, + "requires": { + "contains-path": "^0.1.0", + "debug": "^2.6.8", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.1", + "eslint-module-utils": "^2.2.0", + "has": "^1.0.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.3", + "read-pkg-up": "^2.0.0", + "resolve": "^1.6.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-node": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz", + "integrity": "sha512-lfVw3TEqThwq0j2Ba/Ckn2ABdwmL5dkOgAux1rvOk6CO7A6yGyPI2+zIxN6FyNkp1X1X/BSvKOceD6mBWSj4Yw==", + "dev": true, + "requires": { + "eslint-plugin-es": "^1.3.1", + "eslint-utils": "^1.3.1", + "ignore": "^4.0.2", + "minimatch": "^3.0.4", + "resolve": "^1.8.1", + "semver": "^5.5.0" + } + }, + "eslint-plugin-promise": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz", + "integrity": "sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==", + "dev": true + }, + "eslint-plugin-react": { + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz", + "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==", + "dev": true, + "requires": { + "array-includes": "^3.0.3", + "doctrine": "^2.1.0", + "has": "^1.0.3", + "jsx-ast-utils": "^2.0.1", + "prop-types": "^15.6.2" + } + }, + "eslint-plugin-standard": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz", + "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==", + "dev": true + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, + "espower-location-detector": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/espower-location-detector/-/espower-location-detector-2.0.0.tgz", + "integrity": "sha512-kp13xl+b/EnnVv1qM19rTjeHZ6mrhYqNiOPQwRwzzE5G+/XEeIfxJPdik81Thh+QaxvQxUsVDFHe87DLa7n3jw==", + "requires": { + "is-url": "^1.2.1", + "source-map": "^0.5.0" + } + }, + "espree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", + "dev": true, + "requires": { + "acorn": "^6.0.2", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "espurify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/espurify/-/espurify-2.0.1.tgz", + "integrity": "sha512-7w/dUrReI/QbJFHRwfomTlkQOXaB1NuCrBRn5Y26HXn5gvh18/19AgLbayVrNxXQfkckvgrJloWyvZDuJ7dhEA==" + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "^1.2.1", + "object-assign": "^4.0.1" + } + }, + "find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-cache": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", + "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", + "dev": true, + "requires": { + "circular-json": "^0.3.1", + "graceful-fs": "^4.1.2", + "rimraf": "~2.6.2", + "write": "^0.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", + "dev": true + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", "wrappy": "1" } }, @@ -1014,6 +1817,27 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "inquirer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -1023,15 +1847,81 @@ "loose-envify": "^1.0.0" } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.0" + } + }, "is-url": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==" }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "js-levenshtein": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.4.tgz", - "integrity": "sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", "dev": true }, "js-tokens": { @@ -1040,11 +1930,39 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json5": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", @@ -1054,6 +1972,47 @@ "minimist": "^1.2.0" } }, + "jsx-ast-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.1.0.tgz", + "integrity": "sha512-yDGDG2DS4JcqhA6blsuYbtsT09xL8AoLuUR2Gb5exrw7UEM19sBcOTq+YBBhrNbl0PUC4R4LnFu+dHg2HKeVvA==", + "dev": true, + "requires": { + "array-includes": "^3.0.3" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", @@ -1068,6 +2027,12 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1100,84 +2065,294 @@ } } }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-releases": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.19.tgz", + "integrity": "sha512-SH/B4WwovHbulIALsQllAVwqZZD1kPmKCqrhGfR29dXjLAVZMHvBjD3S6nL9D/J9QkmZ1R92/0wCMDKXUUvyyA==", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=", "dev": true, "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" }, "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { - "ms": "2.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "has-flag": "^3.0.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true } } }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "node-releases": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.3.tgz", - "integrity": "sha512-6VrvH7z6jqqNFY200kdB6HdzkgM96Oaj9v3dqGfgp6mF+cHmU4wyQKZ2/WPDRVoR0Jz9KqbamaBN0ZhdUaysUQ==", + "pkg-config": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pkg-config/-/pkg-config-1.1.1.tgz", + "integrity": "sha1-VX7yLXPaPIg3EHdmxS6tq94pj+Q=", "dev": true, "requires": { - "semver": "^5.3.0" + "debug-log": "^1.0.0", + "find-root": "^1.0.0", + "xtend": "^4.0.1" } }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", "dev": true, "requires": { - "wrappy": "1" + "find-up": "^2.1.0" } }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, "private": { @@ -1186,6 +2361,73 @@ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "react-is": { + "version": "16.8.6", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", + "integrity": "sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, + "readable-stream": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "regenerate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", @@ -1193,35 +2435,47 @@ "dev": true }, "regenerate-unicode-properties": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz", - "integrity": "sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", + "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", "dev": true, "requires": { "regenerate": "^1.4.0" } }, "regenerator-transform": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz", - "integrity": "sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==", + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.4.tgz", + "integrity": "sha512-T0QMBjK3J0MtxjPmdIMXm72Wvj2Abb0Bd4HADdfijwMdoIsyQZ6fWC7kDFhk2YinBBEMZDL7Y7wh0J1sGx3S4A==", "dev": true, "requires": { "private": "^0.1.6" } }, + "regexp-tree": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.10.tgz", + "integrity": "sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ==", + "dev": true + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, "regexpu-core": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.4.0.tgz", - "integrity": "sha512-eDDWElbwwI3K0Lo6CqbQbA6FwgtCz4kYTarrri1okfkRLZAqstU+B3voZBCjg8Fl6iq0gXrJG6MvRgLthfvgOA==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", "dev": true, "requires": { "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^7.0.0", + "regenerate-unicode-properties": "^8.0.2", "regjsgen": "^0.5.0", "regjsparser": "^0.6.0", "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.0.2" + "unicode-match-property-value-ecmascript": "^1.1.0" } }, "regjsgen": { @@ -1247,32 +2501,283 @@ } } }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "^0.1.0", + "resolve-from": "^1.0.0" + } + }, "resolve": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", - "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", + "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", "dev": true, "requires": { "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semistandard": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/semistandard/-/semistandard-13.0.1.tgz", + "integrity": "sha512-2GkuX4BsoMEYoufJYRz8/ERbYDfgOO3yP29IBaoXtxl202azlkV1MsFyoSFiM6GBUfL7MSUxSy38KfM9oDAE2g==", + "dev": true, + "requires": { + "eslint": "~5.4.0", + "eslint-config-semistandard": "13.0.0", + "eslint-config-standard": "12.0.0", + "eslint-config-standard-jsx": "6.0.2", + "eslint-plugin-import": "~2.14.0", + "eslint-plugin-node": "~7.0.1", + "eslint-plugin-promise": "~4.0.0", + "eslint-plugin-react": "~7.11.1", + "eslint-plugin-standard": "~4.0.0", + "standard-engine": "~10.0.0" + } + }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0" + } + }, + "snazzy": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/snazzy/-/snazzy-8.0.0.tgz", + "integrity": "sha512-59GS69hQD8FvJoNGeDz8aZtbYhkCFxCPQB1BFzAWiVVwPmS/J6Vjaku0k6tGNsdSxQ0kAlButdkn8bPR2hLcBw==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "inherits": "^2.0.1", + "minimist": "^1.1.1", + "readable-stream": "^3.0.2", + "standard-json": "^1.0.0", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0" + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz", + "integrity": "sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "standard-engine": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-10.0.0.tgz", + "integrity": "sha512-91BjmzIRZbFmyOY73R6vaDd/7nw5qDWsfpJW5/N+BCXFgmvreyfrRg7oBSu4ihL0gFGXfnwCImJm6j+sZDQQyw==", + "dev": true, + "requires": { + "deglob": "^3.0.0", + "get-stdin": "^6.0.0", + "minimist": "^1.1.0", + "pkg-conf": "^2.0.0" + } + }, + "standard-json": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/standard-json/-/standard-json-1.0.3.tgz", + "integrity": "sha512-lhMP+KREBcfyyMe2ObJlEjJ0lc0ItA9uny83d9ZL6ggYtB79DuaAKCxJVoiflg5EV3D2rpuWn+n4+zXjWXk0sQ==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", + "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -1282,6 +2787,47 @@ "has-flag": "^3.0.0" } }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + }, + "table": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz", + "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "dev": true, + "requires": { + "ajv": "^6.0.1", + "ajv-keywords": "^3.0.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", + "slice-ansi": "1.0.0", + "string-width": "^2.1.1" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -1292,6 +2838,21 @@ "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -1309,15 +2870,61 @@ } }, "unicode-match-property-value-ecmascript": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", - "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", + "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==", "dev": true }, "unicode-property-aliases-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", - "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", + "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==", + "dev": true + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, "wrappy": { @@ -1326,10 +2933,20 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true } } } diff --git a/package.json b/package.json index d7df690..3f4444c 100644 --- a/package.json +++ b/package.json @@ -17,17 +17,19 @@ "dependencies": { "@babel/generator": "^7.0.0", "@babel/parser": "^7.0.0", - "call-matcher": "^1.0.0", - "core-js": "^2.0.0", - "espower-location-detector": "^1.0.0", - "espurify": "^1.6.0", + "call-matcher": "^2.0.0", + "call-signature": "^0.0.2", + "espower-location-detector": "^2.0.0", + "espurify": "^2.0.0", "estraverse": "^4.1.1" }, "devDependencies": { "@babel/core": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", - "mocha": "^5.0.0" + "mocha": "^5.0.0", + "semistandard": "^13.0.1", + "snazzy": "^8.0.0" }, "directories": { "lib": "./lib", @@ -60,6 +62,20 @@ "url": "https://github.com/power-assert-js/babel-plugin-espower.git" }, "scripts": { - "test": "mocha --timeout 0" + "lint": "semistandard --verbose index.js create.js lib/*.js | snazzy", + "fmt": "semistandard --fix index.js create.js lib/*.js", + "test": "npm run lint && mocha --timeout 0" + }, + "semistandard": { + "ignore": [ + "/build/", + "/bench/", + "**/*.jsx" + ], + "globals": [ + "describe", + "beforeEach", + "it" + ] } } diff --git a/test/create-pattern-matchers-test.js b/test/create-pattern-matchers-test.js new file mode 100644 index 0000000..3ded669 --- /dev/null +++ b/test/create-pattern-matchers-test.js @@ -0,0 +1,140 @@ +'use strict'; + +var assert = require('assert'); +var createPatternMatchers = require('../lib/create-pattern-matchers'); + +function withoutMatcher (p) { + var res = Object.assign({}, p); + delete res.matcher; + return res; +} + +describe('createPatternMatchers patterns', function () { + it('string only pattern', function () { + var actual = createPatternMatchers({ + patterns: [ + 'assert(value, [message])' + ] + }).map(withoutMatcher); + assert.deepStrictEqual(actual, [ + { + pattern: 'assert(value, [message])', + index: 0, + params: [ + { + name: 'value', + index: 0, + kind: 'mandatory' + }, + { + name: 'message', + index: 1, + kind: 'optional', + message: true + } + ] + } + ]); + }); + + it('pattern object', function () { + var actual = createPatternMatchers({ + patterns: [ + { + pattern: 'assert.deepEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: {depth: 2 }}, + { name: 'expected', options: {depth: 2 }}, + { name: 'message', message: true }, + ] + } + ] + }).map(withoutMatcher); + assert.deepStrictEqual(actual, [ + { + pattern: 'assert.deepEqual(actual, expected, [message])', + index: 0, + params: [ + { + name: 'actual', + index: 0, + kind: 'mandatory', + options: { depth: 2 } + }, + { + name: 'expected', + index: 1, + kind: 'mandatory', + options: { depth: 2 } + }, + { + name: 'message', + index: 2, + kind: 'optional', + message: true + }, + ] + } + ]); + }); + + it('mixture of strings and objects', function () { + var actual = createPatternMatchers({ + patterns: [ + 'assert(value, [message])', + { + pattern: 'assert.deepEqual(actual, expected, [message])', + params: [ + { name: 'actual', options: {depth: 2 }}, + { name: 'expected', options: {depth: 2 }}, + { name: 'message', message: true }, + ] + } + ] + }).map(withoutMatcher); + assert.deepStrictEqual(actual, [ + { + pattern: 'assert(value, [message])', + index: 0, + params: [ + { + name: 'value', + index: 0, + kind: 'mandatory' + }, + { + name: 'message', + index: 1, + kind: 'optional', + message: true + } + ] + }, + { + pattern: 'assert.deepEqual(actual, expected, [message])', + index: 1, + params: [ + { + name: 'actual', + index: 0, + kind: 'mandatory', + options: { depth: 2 } + }, + { + name: 'expected', + index: 1, + kind: 'mandatory', + options: { depth: 2 } + }, + { + name: 'message', + index: 2, + kind: 'optional', + message: true + }, + ] + } + ]); + }); + +}); diff --git a/test/test.js b/test/fixtures-test.js similarity index 81% rename from test/test.js rename to test/fixtures-test.js index 80fa677..f28c966 100644 --- a/test/test.js +++ b/test/fixtures-test.js @@ -2,19 +2,16 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); var babel = require('@babel/core'); -var assign = require('core-js/library/fn/object/assign'); -var createEspowerPlugin = require('../create'); +var espowerPlugin = require('../index'); function testTransform (fixtureName, extraOptions) { it(fixtureName, function () { var fixtureFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'fixture.js'); var expectedFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'expected.js'); var actualFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'actual.js'); - var result = babel.transformFileSync(fixtureFilepath, assign({ + var result = babel.transformFileSync(fixtureFilepath, Object.assign({ plugins: [ - createEspowerPlugin(babel, { - embedAst: false - }) + espowerPlugin ] }, extraOptions)); var actual = result.code + '\n'; @@ -22,7 +19,7 @@ function testTransform (fixtureName, extraOptions) { if (actual != expected) { fs.writeFileSync(actualFilepath, actual); } - assert.equal(actual, expected); + assert.strictEqual(actual, expected); }); } @@ -53,22 +50,20 @@ describe('babel-plugin-espower', function () { testTransform('YieldExpression'); testTransform('inputSourceMap', { plugins: [ - createEspowerPlugin(babel, { - embedAst: false, + [espowerPlugin, { sourceRoot: "/absolute/" - }) + }] ] }); testTransform('customPatterns', { plugins: [ - createEspowerPlugin(babel, { - embedAst: false, + [espowerPlugin, { patterns: [ 'assert.isNull(object, [message])', 'assert.same(actual, expected, [message])', 'assert.near(actual, expected, delta, [message])' ] - }) + }] ] }); testTransform('CommentsInAssertion'); diff --git a/test/fixtures-with-presets-test.js b/test/fixtures-with-presets-test.js index f08cc62..c4b38c6 100644 --- a/test/fixtures-with-presets-test.js +++ b/test/fixtures-with-presets-test.js @@ -2,8 +2,7 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); var babel = require('@babel/core'); -var assign = require('core-js/library/fn/object/assign'); -var createEspowerPlugin = require('../create'); +var espowerPlugin = require('../index'); function testTransform (fixtureName, extraSuffix, extraOptions) { it(fixtureName, function () { @@ -11,15 +10,13 @@ function testTransform (fixtureName, extraSuffix, extraOptions) { var fixtureFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'fixture.js'); var expectedFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'expected' + suffix + '.js'); var actualFilepath = path.resolve(__dirname, 'fixtures', fixtureName, 'actual' + suffix + '.js'); - var result = babel.transformFileSync(fixtureFilepath, assign({ + var result = babel.transformFileSync(fixtureFilepath, Object.assign({ presets: [ '@babel/env', '@babel/react' ], plugins: [ - createEspowerPlugin(babel, { - embedAst: true - }) + espowerPlugin ] }, extraOptions)); var actual = result.code + '\n'; @@ -27,7 +24,7 @@ function testTransform (fixtureName, extraSuffix, extraOptions) { if (actual != expected) { fs.writeFileSync(actualFilepath, actual); } - assert.equal(actual, expected); + assert.strictEqual(actual, expected); }); } diff --git a/test/fixtures/ArrayExpression/expected-presets-env.js b/test/fixtures/ArrayExpression/expected-presets-env.js index 5f23a15..146d2bb 100644 --- a/test/fixtures/ArrayExpression/expected-presets-env.js +++ b/test/fixtures/ArrayExpression/expected-presets-env.js @@ -1,42 +1,38 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -assert(_rec._expr(_rec._capt([_rec._capt(foo, "arguments/0/elements/0"), _rec._capt(bar, "arguments/0/elements/1")], "arguments/0"), { - content: "assert([foo, bar])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert([foo, bar])", "test/fixtures/ArrayExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[8,11]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[13,16]}],\"range\":[7,17]}],\"range\":[0,18]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"[\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[8,11]},{\"type\":{\"label\":\",\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[13,16]},{\"type\":{\"label\":\"]\"},\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(_typeof(_rec2._capt([_rec2._capt([_rec2._capt(_rec2._capt(foo, "arguments/0/left/argument/elements/0/elements/0/object").bar, "arguments/0/left/argument/elements/0/elements/0"), _rec2._capt(baz(_rec2._capt(moo, "arguments/0/left/argument/elements/0/elements/1/arguments/0")), "arguments/0/left/argument/elements/0/elements/1")], "arguments/0/left/argument/elements/0"), _rec2._capt(+_rec2._capt(fourStr, "arguments/0/left/argument/elements/1/argument"), "arguments/0/left/argument/elements/1")], "arguments/0/left/argument")), "arguments/0/left") === 'number', "arguments/0"), { - content: "assert(typeof [[foo.bar, baz(moo)], +fourStr] === 'number')", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(typeof [[foo.bar, baz(moo)], +fourStr] === 'number')", "test/fixtures/ArrayExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[16,19]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[20,23]},\"computed\":false,\"range\":[16,23]},{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[25,28]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"moo\",\"range\":[29,32]}],\"range\":[25,33]}],\"range\":[15,34]},{\"type\":\"UnaryExpression\",\"operator\":\"+\",\"argument\":{\"type\":\"Identifier\",\"name\":\"fourStr\",\"range\":[37,44]},\"prefix\":true,\"range\":[36,44]}],\"range\":[14,45]},\"prefix\":true,\"range\":[7,45]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"number\",\"range\":[50,58]},\"range\":[7,58]}],\"range\":[0,59]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"[\"},\"range\":[14,15]},{\"type\":{\"label\":\"[\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[16,19]},{\"type\":{\"label\":\".\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[20,23]},{\"type\":{\"label\":\",\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[25,28]},{\"type\":{\"label\":\"(\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"moo\",\"range\":[29,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]},{\"type\":{\"label\":\"]\"},\"range\":[33,34]},{\"type\":{\"label\":\",\"},\"range\":[34,35]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[36,37]},{\"type\":{\"label\":\"name\"},\"value\":\"fourStr\",\"range\":[37,44]},{\"type\":{\"label\":\"]\"},\"range\":[44,45]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[46,49]},{\"type\":{\"label\":\"string\"},\"value\":\"number\",\"range\":[50,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert.notDeepEqual(_rec3._expr(_rec3._capt([_rec3._capt(foo, "arguments/0/elements/0"), _rec3._capt(bar, "arguments/0/elements/1")], "arguments/0"), { - content: "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 7, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"notDeepEqual\",\"range\":[7,19]},\"computed\":false,\"range\":[0,19]},\"arguments\":[{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[21,24]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[26,29]}],\"range\":[20,30]},{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[33,37]},{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[39,43]},{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[45,49]}],\"range\":[32,50]}],\"range\":[0,51]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"notDeepEqual\",\"range\":[7,19]},{\"type\":{\"label\":\"(\"},\"range\":[19,20]},{\"type\":{\"label\":\"[\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[26,29]},{\"type\":{\"label\":\"]\"},\"range\":[29,30]},{\"type\":{\"label\":\",\"},\"range\":[30,31]},{\"type\":{\"label\":\"[\"},\"range\":[32,33]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[33,37]},{\"type\":{\"label\":\",\"},\"range\":[37,38]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[39,43]},{\"type\":{\"label\":\",\"},\"range\":[43,44]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[45,49]},{\"type\":{\"label\":\"]\"},\"range\":[49,50]},{\"type\":{\"label\":\")\"},\"range\":[50,51]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"[\"},\"range\":[14,15]},{\"type\":{\"label\":\"[\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[16,19]},{\"type\":{\"label\":\".\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[20,23]},{\"type\":{\"label\":\",\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[25,28]},{\"type\":{\"label\":\"(\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"moo\",\"range\":[29,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]},{\"type\":{\"label\":\"]\"},\"range\":[33,34]},{\"type\":{\"label\":\",\"},\"range\":[34,35]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[36,37]},{\"type\":{\"label\":\"name\"},\"value\":\"fourStr\",\"range\":[37,44]},{\"type\":{\"label\":\"]\"},\"range\":[44,45]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[46,49]},{\"type\":{\"label\":\"string\"},\"value\":\"number\",\"range\":[50,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec4._expr(_rec4._capt([_rec4._capt(hoge, "arguments/1/elements/0"), _rec4._capt(fuga, "arguments/1/elements/1"), _rec4._capt(piyo, "arguments/1/elements/2")], "arguments/1"), { - content: "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(7, "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", "test/fixtures/ArrayExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"notDeepEqual\",\"range\":[7,19]},\"computed\":false,\"range\":[0,19]},\"arguments\":[{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[21,24]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[26,29]}],\"range\":[20,30]},{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[33,37]},{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[39,43]},{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[45,49]}],\"range\":[32,50]}],\"range\":[0,51]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"notDeepEqual\",\"range\":[7,19]},{\"type\":{\"label\":\"(\"},\"range\":[19,20]},{\"type\":{\"label\":\"[\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[26,29]},{\"type\":{\"label\":\"]\"},\"range\":[29,30]},{\"type\":{\"label\":\",\"},\"range\":[30,31]},{\"type\":{\"label\":\"[\"},\"range\":[32,33]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[33,37]},{\"type\":{\"label\":\",\"},\"range\":[37,38]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[39,43]},{\"type\":{\"label\":\",\"},\"range\":[43,44]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[45,49]},{\"type\":{\"label\":\"]\"},\"range\":[49,50]},{\"type\":{\"label\":\")\"},\"range\":[50,51]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag3 = new _ArgumentRecorder(assert.notDeepEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.notDeepEqual, _am3, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec([_ag._tap(foo, "arguments/0/elements/0"), _ag._tap(bar, "arguments/0/elements/1")], "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(_typeof(_ag2._tap([_ag2._tap([_ag2._tap(_ag2._tap(foo, "arguments/0/left/argument/elements/0/elements/0/object").bar, "arguments/0/left/argument/elements/0/elements/0"), _ag2._tap(baz(_ag2._tap(moo, "arguments/0/left/argument/elements/0/elements/1/arguments/0")), "arguments/0/left/argument/elements/0/elements/1")], "arguments/0/left/argument/elements/0"), _ag2._tap(+_ag2._tap(fourStr, "arguments/0/left/argument/elements/1/argument"), "arguments/0/left/argument/elements/1")], "arguments/0/left/argument")), "arguments/0/left") === 'number', "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.notDeepEqual(_ag3._rec([_ag3._tap(foo, "arguments/0/elements/0"), _ag3._tap(bar, "arguments/0/elements/1")], "arguments/0"), _ag4._rec([_ag4._tap(hoge, "arguments/1/elements/0"), _ag4._tap(fuga, "arguments/1/elements/1"), _ag4._tap(piyo, "arguments/1/elements/2")], "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/ArrayExpression/expected.js b/test/fixtures/ArrayExpression/expected.js index 2446e12..a216198 100644 --- a/test/fixtures/ArrayExpression/expected.js +++ b/test/fixtures/ArrayExpression/expected.js @@ -1,27 +1,17 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert([foo, bar])", "test/fixtures/ArrayExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(typeof [[foo.bar, baz(moo)], +fourStr] === 'number')", "test/fixtures/ArrayExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(7, "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", "test/fixtures/ArrayExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert.notDeepEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.notDeepEqual, _am3, 1); -assert(_rec._expr(_rec._capt([_rec._capt(foo, "arguments/0/elements/0"), _rec._capt(bar, "arguments/0/elements/1")], "arguments/0"), { - content: "assert([foo, bar])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(typeof _rec2._capt([_rec2._capt([_rec2._capt(_rec2._capt(foo, "arguments/0/left/argument/elements/0/elements/0/object").bar, "arguments/0/left/argument/elements/0/elements/0"), _rec2._capt(baz(_rec2._capt(moo, "arguments/0/left/argument/elements/0/elements/1/arguments/0")), "arguments/0/left/argument/elements/0/elements/1")], "arguments/0/left/argument/elements/0"), _rec2._capt(+_rec2._capt(fourStr, "arguments/0/left/argument/elements/1/argument"), "arguments/0/left/argument/elements/1")], "arguments/0/left/argument"), "arguments/0/left") === 'number', "arguments/0"), { - content: "assert(typeof [[foo.bar, baz(moo)], +fourStr] === 'number')", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 5 -})); -assert.notDeepEqual(_rec3._expr(_rec3._capt([_rec3._capt(foo, "arguments/0/elements/0"), _rec3._capt(bar, "arguments/0/elements/1")], "arguments/0"), { - content: "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 7 -}), _rec4._expr(_rec4._capt([_rec4._capt(hoge, "arguments/1/elements/0"), _rec4._capt(fuga, "arguments/1/elements/1"), _rec4._capt(piyo, "arguments/1/elements/2")], "arguments/1"), { - content: "assert.notDeepEqual([foo, bar], [hoge, fuga, piyo])", - filepath: "test/fixtures/ArrayExpression/fixture.js", - line: 7 -})); +assert(_ag._rec([_ag._tap(foo, "arguments/0/elements/0"), _ag._tap(bar, "arguments/0/elements/1")], "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(typeof _ag2._tap([_ag2._tap([_ag2._tap(_ag2._tap(foo, "arguments/0/left/argument/elements/0/elements/0/object").bar, "arguments/0/left/argument/elements/0/elements/0"), _ag2._tap(baz(_ag2._tap(moo, "arguments/0/left/argument/elements/0/elements/1/arguments/0")), "arguments/0/left/argument/elements/0/elements/1")], "arguments/0/left/argument/elements/0"), _ag2._tap(+_ag2._tap(fourStr, "arguments/0/left/argument/elements/1/argument"), "arguments/0/left/argument/elements/1")], "arguments/0/left/argument"), "arguments/0/left") === 'number', "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.notDeepEqual(_ag3._rec([_ag3._tap(foo, "arguments/0/elements/0"), _ag3._tap(bar, "arguments/0/elements/1")], "arguments/0"), _ag4._rec([_ag4._tap(hoge, "arguments/1/elements/0"), _ag4._tap(fuga, "arguments/1/elements/1"), _ag4._tap(piyo, "arguments/1/elements/2")], "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/ArrowFunctionExpression/expected-presets-env.js b/test/fixtures/ArrowFunctionExpression/expected-presets-env.js index b8101c2..39f0564 100644 --- a/test/fixtures/ArrowFunctionExpression/expected-presets-env.js +++ b/test/fixtures/ArrowFunctionExpression/expected-presets-env.js @@ -1,8 +1,39 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(v => v + 1)", "test/fixtures/ArrowFunctionExpression/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ArrowFunctionExpression\",\"params\":[{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[7,8]}],\"body\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[12,13]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[16,17]},\"range\":[12,17]},\"async\":false,\"range\":[7,17]}],\"range\":[0,18]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[7,8]},{\"type\":{\"label\":\"=>\"},\"range\":[9,11]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[12,13]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[14,15]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am2 = _pwmeta(0, "assert((v, i) => v + i)", "test/fixtures/ArrowFunctionExpression/fixture.js", 5, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ArrowFunctionExpression\",\"params\":[{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[8,9]},{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[11,12]}],\"body\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[17,18]},\"right\":{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[21,22]},\"range\":[17,22]},\"async\":false,\"range\":[7,22]}],\"range\":[0,23]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[8,9]},{\"type\":{\"label\":\",\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[11,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]},{\"type\":{\"label\":\"=>\"},\"range\":[14,16]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[17,18]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am3 = _pwmeta(0, "assert(v => ({ even: v, odd: v + 1 }))", "test/fixtures/ArrowFunctionExpression/fixture.js", 7, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ArrowFunctionExpression\",\"params\":[{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[7,8]}],\"body\":{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"even\",\"range\":[15,19]},\"value\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[21,22]},\"computed\":false,\"shorthand\":false,\"range\":[15,22]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"odd\",\"range\":[24,27]},\"value\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[29,30]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[33,34]},\"range\":[29,34]},\"computed\":false,\"shorthand\":false,\"range\":[24,34]}],\"range\":[13,36]},\"async\":false,\"range\":[7,37]}],\"range\":[0,38]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[7,8]},{\"type\":{\"label\":\"=>\"},\"range\":[9,11]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"{\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"even\",\"range\":[15,19]},{\"type\":{\"label\":\":\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[21,22]},{\"type\":{\"label\":\",\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"odd\",\"range\":[24,27]},{\"type\":{\"label\":\":\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[29,30]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[31,32]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[33,34]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\")\"},\"range\":[36,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am4 = _pwmeta(0, "assert(seven === ((v, i) => v + i)(four, five))", "test/fixtures/ArrowFunctionExpression/fixture.js", 9, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[7,12]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"ArrowFunctionExpression\",\"params\":[{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[19,20]},{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[22,23]}],\"body\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[28,29]},\"right\":{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[32,33]},\"range\":[28,33]},\"async\":false,\"range\":[18,33]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"four\",\"range\":[35,39]},{\"type\":\"Identifier\",\"name\":\"five\",\"range\":[41,45]}],\"range\":[17,46]},\"range\":[7,46]}],\"range\":[0,47]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[7,12]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[13,16]},{\"type\":{\"label\":\"(\"},\"range\":[17,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[19,20]},{\"type\":{\"label\":\",\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\"=>\"},\"range\":[25,27]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[28,29]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[32,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"(\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"four\",\"range\":[35,39]},{\"type\":{\"label\":\",\"},\"range\":[39,40]},{\"type\":{\"label\":\"name\"},\"value\":\"five\",\"range\":[41,45]},{\"type\":{\"label\":\")\"},\"range\":[45,46]},{\"type\":{\"label\":\")\"},\"range\":[46,47]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am4, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } assert(function (v) { return v + 1; @@ -16,13 +47,6 @@ assert(function (v) { odd: v + 1 }; }); -assert(_rec._expr(_rec._capt(_rec._capt(seven, "arguments/0/left") === _rec._capt(function (v, i) { +assert(_ag._rec(_ag._tap(seven, "arguments/0/left") === _ag._tap(function (v, i) { return v + i; -}(_rec._capt(four, "arguments/0/right/arguments/0"), _rec._capt(five, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(seven === ((v, i) => v + i)(four, five))", - filepath: "test/fixtures/ArrowFunctionExpression/fixture.js", - line: 9, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[7,12]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"ArrowFunctionExpression\",\"params\":[{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[19,20]},{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[22,23]}],\"body\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"v\",\"range\":[28,29]},\"right\":{\"type\":\"Identifier\",\"name\":\"i\",\"range\":[32,33]},\"range\":[28,33]},\"async\":false,\"range\":[18,33]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"four\",\"range\":[35,39]},{\"type\":\"Identifier\",\"name\":\"five\",\"range\":[41,45]}],\"range\":[17,46]},\"range\":[7,46]}],\"range\":[0,47]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[7,12]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[13,16]},{\"type\":{\"label\":\"(\"},\"range\":[17,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[19,20]},{\"type\":{\"label\":\",\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\"=>\"},\"range\":[25,27]},{\"type\":{\"label\":\"name\"},\"value\":\"v\",\"range\":[28,29]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"i\",\"range\":[32,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"(\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"four\",\"range\":[35,39]},{\"type\":{\"label\":\",\"},\"range\":[39,40]},{\"type\":{\"label\":\"name\"},\"value\":\"five\",\"range\":[41,45]},{\"type\":{\"label\":\")\"},\"range\":[45,46]},{\"type\":{\"label\":\")\"},\"range\":[46,47]}]", - visitorKeys: _powerAssertVisitorKeys -})); +}(_ag._tap(four, "arguments/0/right/arguments/0"), _ag._tap(five, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/ArrowFunctionExpression/expected.js b/test/fixtures/ArrowFunctionExpression/expected.js index cc3c47c..073ccc9 100644 --- a/test/fixtures/ArrowFunctionExpression/expected.js +++ b/test/fixtures/ArrowFunctionExpression/expected.js @@ -1,7 +1,14 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(v => v + 1)", "test/fixtures/ArrowFunctionExpression/fixture.js", 3), + _am2 = _pwmeta(0, "assert((v, i) => v + i)", "test/fixtures/ArrowFunctionExpression/fixture.js", 5), + _am3 = _pwmeta(0, "assert(v => ({ even: v, odd: v + 1 }))", "test/fixtures/ArrowFunctionExpression/fixture.js", 7), + _am4 = _pwmeta(0, "assert(seven === ((v, i) => v + i)(four, five))", "test/fixtures/ArrowFunctionExpression/fixture.js", 9), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am4, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); assert(v => v + 1); assert((v, i) => v + i); @@ -9,8 +16,4 @@ assert(v => ({ even: v, odd: v + 1 })); -assert(_rec._expr(_rec._capt(_rec._capt(seven, "arguments/0/left") === _rec._capt(((v, i) => v + i)(_rec._capt(four, "arguments/0/right/arguments/0"), _rec._capt(five, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(seven === ((v, i) => v + i)(four, five))", - filepath: "test/fixtures/ArrowFunctionExpression/fixture.js", - line: 9 -})); +assert(_ag._rec(_ag._tap(seven, "arguments/0/left") === _ag._tap(((v, i) => v + i)(_ag._tap(four, "arguments/0/right/arguments/0"), _ag._tap(five, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/AssignmentExpression/expected-presets-env.js b/test/fixtures/AssignmentExpression/expected-presets-env.js index e8a2138..8c38d93 100644 --- a/test/fixtures/AssignmentExpression/expected-presets-env.js +++ b/test/fixtures/AssignmentExpression/expected-presets-env.js @@ -1,79 +1,71 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec6$_capt, - _rec6$_capt2, - _rec7$_capt, - _rec7$_capt2; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -assert(_rec._expr(_rec._capt(counter += 1, "arguments/0"), { - content: "assert(counter += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(counter += 1)", "test/fixtures/AssignmentExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"+=\",\"left\":{\"type\":\"Identifier\",\"name\":\"counter\",\"range\":[7,14]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[18,19]},\"range\":[7,19]}],\"range\":[0,20]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"counter\",\"range\":[7,14]},{\"type\":{\"label\":\"_=\"},\"value\":\"+=\",\"range\":[15,17]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[18,19]},{\"type\":{\"label\":\")\"},\"range\":[19,20]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(dog.age += 1, "arguments/0"), { - content: "assert(dog.age += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(dog.age += 1)", "test/fixtures/AssignmentExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"+=\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"dog\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"age\",\"range\":[11,14]},\"computed\":false,\"range\":[7,14]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[18,19]},\"range\":[7,19]}],\"range\":[0,20]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"dog\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"age\",\"range\":[11,14]},{\"type\":{\"label\":\"_=\"},\"value\":\"+=\",\"range\":[15,17]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[18,19]},{\"type\":{\"label\":\")\"},\"range\":[19,20]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(dog.age += 1, "arguments/0"), { - content: "assert(dog.age += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(dog.age += 1)", "test/fixtures/AssignmentExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"+=\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"dog\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"age\",\"range\":[11,14]},\"computed\":false,\"range\":[7,14]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[18,19]},\"range\":[7,19]}],\"range\":[0,20]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"dog\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"age\",\"range\":[11,14]},{\"type\":{\"label\":\"_=\"},\"value\":\"+=\",\"range\":[15,17]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[18,19]},{\"type\":{\"label\":\")\"},\"range\":[19,20]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.strictEqual(_rec4._expr(_rec4._capt(dog.age += 1, "arguments/0"), { - content: "assert.strictEqual(dog.age += 1, three)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 9, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"+=\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"dog\",\"range\":[19,22]},\"property\":{\"type\":\"Identifier\",\"name\":\"age\",\"range\":[23,26]},\"computed\":false,\"range\":[19,26]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[30,31]},\"range\":[19,31]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[33,38]}],\"range\":[0,39]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"dog\",\"range\":[19,22]},{\"type\":{\"label\":\".\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"age\",\"range\":[23,26]},{\"type\":{\"label\":\"_=\"},\"value\":\"+=\",\"range\":[27,29]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[30,31]},{\"type\":{\"label\":\",\"},\"range\":[31,32]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[33,38]},{\"type\":{\"label\":\")\"},\"range\":[38,39]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec5._expr(_rec5._capt(three, "arguments/1"), { - content: "assert.strictEqual(dog.age += 1, three)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(4, "assert.strictEqual(dog.age += 1, three)", "test/fixtures/AssignmentExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"+=\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"dog\",\"range\":[19,22]},\"property\":{\"type\":\"Identifier\",\"name\":\"age\",\"range\":[23,26]},\"computed\":false,\"range\":[19,26]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[30,31]},\"range\":[19,31]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[33,38]}],\"range\":[0,39]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"dog\",\"range\":[19,22]},{\"type\":{\"label\":\".\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"age\",\"range\":[23,26]},{\"type\":{\"label\":\"_=\"},\"value\":\"+=\",\"range\":[27,29]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[30,31]},{\"type\":{\"label\":\",\"},\"range\":[31,32]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[33,38]},{\"type\":{\"label\":\")\"},\"range\":[38,39]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr(_rec6._capt((_rec6$_capt = _rec6._capt([3], "arguments/0/right"), _rec6$_capt2 = _slicedToArray(_rec6$_capt, 1), x = _rec6$_capt2[0], _rec6$_capt), "arguments/0"), { - content: "assert([x] = [3])", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert.strictEqual, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.strictEqual, _am4, 1), + _am5 = _pwmeta(0, "assert([x] = [3])", "test/fixtures/AssignmentExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"=\",\"left\":{\"type\":\"ArrayPattern\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"x\",\"range\":[8,9]}],\"range\":[7,10]},\"right\":{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"NumericLiteral\",\"value\":3,\"range\":[14,15]}],\"range\":[13,16]},\"range\":[7,16]}],\"range\":[0,17]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"[\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"x\",\"range\":[8,9]},{\"type\":{\"label\":\"]\"},\"range\":[9,10]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[11,12]},{\"type\":{\"label\":\"[\"},\"range\":[13,14]},{\"type\":{\"label\":\"num\"},\"value\":3,\"range\":[14,15]},{\"type\":{\"label\":\"]\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec7._expr(_rec7._capt((_rec7$_capt = _rec7._capt([_rec7._capt(foo, "arguments/0/right/elements/0")], "arguments/0/right"), _rec7$_capt2 = _slicedToArray(_rec7$_capt, 1), x = _rec7$_capt2[0], _rec7$_capt), "arguments/0"), { - content: "assert([x] = [foo])", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 13, +}), + _ag6 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert([x] = [foo])", "test/fixtures/AssignmentExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"AssignmentExpression\",\"operator\":\"=\",\"left\":{\"type\":\"ArrayPattern\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"x\",\"range\":[8,9]}],\"range\":[7,10]},\"right\":{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[14,17]}],\"range\":[13,18]},\"range\":[7,18]}],\"range\":[0,19]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"[\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"x\",\"range\":[8,9]},{\"type\":{\"label\":\"]\"},\"range\":[9,10]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[11,12]},{\"type\":{\"label\":\"[\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\"]\"},\"range\":[17,18]},{\"type\":{\"label\":\")\"},\"range\":[18,19]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag7 = new _ArgumentRecorder(assert, _am6, 0), + _ag6$_tap, + _ag6$_tap2, + _ag7$_tap, + _ag7$_tap2; + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(counter += 1, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(dog.age += 1, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(dog.age += 1, "arguments/0"), new _AssertionMessage(_am3, -1)); +assert.strictEqual(_ag4._rec(dog.age += 1, "arguments/0"), _ag5._rec(three, "arguments/1"), new _AssertionMessage(_am4, -1)); +assert(_ag6._rec((_ag6$_tap = _ag6._tap([3], "arguments/0/right"), _ag6$_tap2 = _slicedToArray(_ag6$_tap, 1), x = _ag6$_tap2[0], _ag6$_tap), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag7._rec((_ag7$_tap = _ag7._tap([_ag7._tap(foo, "arguments/0/right/elements/0")], "arguments/0/right"), _ag7$_tap2 = _slicedToArray(_ag7$_tap, 1), x = _ag7$_tap2[0], _ag7$_tap), "arguments/0"), new _AssertionMessage(_am6, -1)); diff --git a/test/fixtures/AssignmentExpression/expected.js b/test/fixtures/AssignmentExpression/expected.js index b0f2b74..56a33b1 100644 --- a/test/fixtures/AssignmentExpression/expected.js +++ b/test/fixtures/AssignmentExpression/expected.js @@ -1,45 +1,26 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(counter += 1)", "test/fixtures/AssignmentExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(dog.age += 1)", "test/fixtures/AssignmentExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(dog.age += 1)", "test/fixtures/AssignmentExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(4, "assert.strictEqual(dog.age += 1, three)", "test/fixtures/AssignmentExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert.strictEqual, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.strictEqual, _am4, 1), + _am5 = _pwmeta(0, "assert([x] = [3])", "test/fixtures/AssignmentExpression/fixture.js", 11), + _ag6 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert([x] = [foo])", "test/fixtures/AssignmentExpression/fixture.js", 13), + _ag7 = new _ArgumentRecorder(assert, _am6, 0); -assert(_rec._expr(_rec._capt(counter += 1, "arguments/0"), { - content: "assert(counter += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(dog.age += 1, "arguments/0"), { - content: "assert(dog.age += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(dog.age += 1, "arguments/0"), { - content: "assert(dog.age += 1)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 7 -})); -assert.strictEqual(_rec4._expr(_rec4._capt(dog.age += 1, "arguments/0"), { - content: "assert.strictEqual(dog.age += 1, three)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 9 -}), _rec5._expr(_rec5._capt(three, "arguments/1"), { - content: "assert.strictEqual(dog.age += 1, three)", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 9 -})); -assert(_rec6._expr(_rec6._capt([x] = _rec6._capt([3], "arguments/0/right"), "arguments/0"), { - content: "assert([x] = [3])", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 11 -})); -assert(_rec7._expr(_rec7._capt([x] = _rec7._capt([_rec7._capt(foo, "arguments/0/right/elements/0")], "arguments/0/right"), "arguments/0"), { - content: "assert([x] = [foo])", - filepath: "test/fixtures/AssignmentExpression/fixture.js", - line: 13 -})); +assert(_ag._rec(counter += 1, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(dog.age += 1, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(dog.age += 1, "arguments/0"), new _AssertionMessage(_am3, -1)); +assert.strictEqual(_ag4._rec(dog.age += 1, "arguments/0"), _ag5._rec(three, "arguments/1"), new _AssertionMessage(_am4, -1)); +assert(_ag6._rec([x] = _ag6._tap([3], "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag7._rec([x] = _ag7._tap([_ag7._tap(foo, "arguments/0/right/elements/0")], "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am6, -1)); diff --git a/test/fixtures/AwaitExpression/expected-presets-env.js b/test/fixtures/AwaitExpression/expected-presets-env.js index 7556bf2..aaf9c7e 100644 --- a/test/fixtures/AwaitExpression/expected-presets-env.js +++ b/test/fixtures/AwaitExpression/expected-presets-env.js @@ -1,12 +1,23 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + function myAsync(_x) { return _myAsync.apply(this, arguments); } // function notAsync(a){ @@ -18,42 +29,38 @@ function _myAsync() { _myAsync = _asyncToGenerator( /*#__PURE__*/ regeneratorRuntime.mark(function _callee(a) { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert((await a) === 3)", "test/fixtures/AwaitExpression/fixture.js", 4, { + async: true, + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"AwaitExpression\",\"argument\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[14,15]},\"range\":[8,15]},\"right\":{\"type\":\"NumericLiteral\",\"value\":3,\"range\":[21,22]},\"range\":[7,22]}],\"range\":[0,23]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"await\",\"range\":[8,13]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[17,20]},{\"type\":{\"label\":\"num\"},\"value\":3,\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag = new _ArgumentRecorder(assert, _am, 0); return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.t0 = assert; - _context.t1 = _rec; - _context.t2 = _rec; - _context.t3 = _rec; - _context.next = 6; - return a; - - case 6: - _context.t4 = _context.sent; - _context.t5 = _context.t3._capt.call(_context.t3, _context.t4, "arguments/0/left"); - _context.t6 = _context.t5 === 3; - _context.t7 = _context.t2._capt.call(_context.t2, _context.t6, "arguments/0"); - _context.t8 = { - content: "assert((await a) === 3)", - filepath: "test/fixtures/AwaitExpression/fixture.js", - line: 4, - async: true, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"AwaitExpression\",\"argument\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[14,15]},\"range\":[8,15]},\"right\":{\"type\":\"NumericLiteral\",\"value\":3,\"range\":[21,22]},\"range\":[7,22]}],\"range\":[0,23]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"await\",\"range\":[8,13]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[17,20]},{\"type\":{\"label\":\"num\"},\"value\":3,\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", - visitorKeys: _powerAssertVisitorKeys - }; - _context.t9 = _context.t1._expr.call(_context.t1, _context.t7, _context.t8); - (0, _context.t0)(_context.t9); - - case 13: + _context.t1 = _ag; + _context.t2 = _ag; + _context.next = 5; + return _ag._tap(a, "arguments/0/left/argument"); + + case 5: + _context.t3 = _context.sent; + _context.t4 = _context.t2._tap.call(_context.t2, _context.t3, "arguments/0/left"); + _context.t5 = _context.t4 === 3; + _context.t6 = _context.t1._rec.call(_context.t1, _context.t5, "arguments/0"); + _context.t7 = new _AssertionMessage(_am, -1); + (0, _context.t0)(_context.t6, _context.t7); + + case 11: case "end": return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _myAsync.apply(this, arguments); } diff --git a/test/fixtures/BinaryExpression/expected-presets-env.js b/test/fixtures/BinaryExpression/expected-presets-env.js index 873e61b..dde171d 100644 --- a/test/fixtures/BinaryExpression/expected-presets-env.js +++ b/test/fixtures/BinaryExpression/expected-presets-env.js @@ -1,86 +1,79 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(4 !== 4, "arguments/0"), { - content: "assert(4 !== 4)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(4 !== 4)", "test/fixtures/BinaryExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"NumericLiteral\",\"value\":4,\"range\":[7,8]},\"right\":{\"type\":\"NumericLiteral\",\"value\":4,\"range\":[13,14]},\"range\":[7,14]}],\"range\":[0,15]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[7,8]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[9,12]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[13,14]},{\"type\":{\"label\":\")\"},\"range\":[14,15]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[7,8]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[9,12]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[13,14]},{\"type\":{\"label\":\")\"},\"range\":[14,15]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(fuga, "arguments/0/left") !== 4, "arguments/0"), { - content: "assert(fuga !== 4)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(fuga !== 4)", "test/fixtures/BinaryExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"NumericLiteral\",\"value\":4,\"range\":[16,17]},\"range\":[7,17]}],\"range\":[0,18]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"num\"},\"value\":4,\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(fuga, "arguments/0/left") === _rec3._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(fuga, "arguments/0/left") === _rec4._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(fuga, "arguments/0/left") === _rec5._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 13, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(fuga, "arguments/0/left") !== _rec6._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga !== piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 15, +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(fuga !== piyo)", "test/fixtures/BinaryExpression/fixture.js", 15, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.ok(_rec7._expr(_rec7._capt(_rec7._capt(hoge, "arguments/0/left") === _rec7._capt(fuga, "arguments/0/right"), "arguments/0"), { - content: "assert.ok(hoge === fuga, 'comment')", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 17, +}), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(1, "assert.ok(hoge === fuga, 'comment')", "test/fixtures/BinaryExpression/fixture.js", 17, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"ok\",\"range\":[7,9]},\"computed\":false,\"range\":[0,9]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[10,14]},\"right\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[19,23]},\"range\":[10,23]},{\"type\":\"StringLiteral\",\"value\":\"comment\",\"range\":[25,34]}],\"range\":[0,35]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[10,14]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[15,18]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[19,23]},{\"type\":{\"label\":\",\"},\"range\":[23,24]},{\"type\":{\"label\":\"string\"},\"value\":\"comment\",\"range\":[25,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[10,14]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[15,18]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[19,23]},{\"type\":{\"label\":\",\"},\"range\":[23,24]},{\"type\":{\"label\":\"string\"},\"value\":\"comment\",\"range\":[25,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]}]", visitorKeys: _powerAssertVisitorKeys -}), 'comment'); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(ary1, "arguments/0/left/object").length, "arguments/0/left") === _rec8._capt(_rec8._capt(ary2, "arguments/0/right/object").length, "arguments/0/right"), "arguments/0"), { - content: "assert(ary1.length === ary2.length)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 19, +}), + _ag7 = new _ArgumentRecorder(assert.ok, _am7, 0), + _am8 = _pwmeta(0, "assert(ary1.length === ary2.length)", "test/fixtures/BinaryExpression/fixture.js", 19, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary1\",\"range\":[7,11]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[12,18]},\"computed\":false,\"range\":[7,18]},\"right\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary2\",\"range\":[23,27]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[28,34]},\"computed\":false,\"range\":[23,34]},\"range\":[7,34]}],\"range\":[0,35]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ary1\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[12,18]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[19,22]},{\"type\":{\"label\":\"name\"},\"value\":\"ary2\",\"range\":[23,27]},{\"type\":{\"label\":\".\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[28,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ary1\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[12,18]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[19,22]},{\"type\":{\"label\":\"name\"},\"value\":\"ary2\",\"range\":[23,27]},{\"type\":{\"label\":\".\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[28,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec9._expr(_rec9._capt(_rec9._capt(foo, "arguments/0/left") instanceof _rec9._capt(Foo, "arguments/0/right"), "arguments/0"), { - content: "assert(foo instanceof Foo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 21, +}), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert(foo instanceof Foo)", "test/fixtures/BinaryExpression/fixture.js", 21, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"instanceof\",\"left\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"right\":{\"type\":\"Identifier\",\"name\":\"Foo\",\"range\":[22,25]},\"range\":[7,25]}],\"range\":[0,26]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"instanceof\"},\"value\":\"instanceof\",\"range\":[11,21]},{\"type\":{\"label\":\"name\"},\"value\":\"Foo\",\"range\":[22,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag9 = new _ArgumentRecorder(assert, _am9, 0); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(4 !== 4, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(fuga, "arguments/0/left") !== 4, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(fuga, "arguments/0/left") === _ag3._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(fuga, "arguments/0/left") === _ag4._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(fuga, "arguments/0/left") === _ag5._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(fuga, "arguments/0/left") !== _ag6._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am6, -1)); +assert.ok(_ag7._rec(_ag7._tap(hoge, "arguments/0/left") === _ag7._tap(fuga, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am7, 1, 'comment')); +assert(_ag8._rec(_ag8._tap(_ag8._tap(ary1, "arguments/0/left/object").length, "arguments/0/left") === _ag8._tap(_ag8._tap(ary2, "arguments/0/right/object").length, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag9._rec(_ag9._tap(foo, "arguments/0/left") instanceof _ag9._tap(Foo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am9, -1)); diff --git a/test/fixtures/BinaryExpression/expected.js b/test/fixtures/BinaryExpression/expected.js index 407e157..969be7b 100644 --- a/test/fixtures/BinaryExpression/expected.js +++ b/test/fixtures/BinaryExpression/expected.js @@ -1,58 +1,34 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(4 !== 4)", "test/fixtures/BinaryExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(fuga !== 4)", "test/fixtures/BinaryExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(fuga === piyo)", "test/fixtures/BinaryExpression/fixture.js", 13), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(fuga !== piyo)", "test/fixtures/BinaryExpression/fixture.js", 15), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(1, "assert.ok(hoge === fuga, 'comment')", "test/fixtures/BinaryExpression/fixture.js", 17), + _ag7 = new _ArgumentRecorder(assert.ok, _am7, 0), + _am8 = _pwmeta(0, "assert(ary1.length === ary2.length)", "test/fixtures/BinaryExpression/fixture.js", 19), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert(foo instanceof Foo)", "test/fixtures/BinaryExpression/fixture.js", 21), + _ag9 = new _ArgumentRecorder(assert, _am9, 0); -assert(_rec._expr(_rec._capt(4 !== 4, "arguments/0"), { - content: "assert(4 !== 4)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(fuga, "arguments/0/left") !== 4, "arguments/0"), { - content: "assert(fuga !== 4)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(fuga, "arguments/0/left") === _rec3._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(fuga, "arguments/0/left") === _rec4._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 9 -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(fuga, "arguments/0/left") === _rec5._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga === piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 13 -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(fuga, "arguments/0/left") !== _rec6._capt(piyo, "arguments/0/right"), "arguments/0"), { - content: "assert(fuga !== piyo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 15 -})); -assert.ok(_rec7._expr(_rec7._capt(_rec7._capt(hoge, "arguments/0/left") === _rec7._capt(fuga, "arguments/0/right"), "arguments/0"), { - content: "assert.ok(hoge === fuga, 'comment')", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 17 -}), 'comment'); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(ary1, "arguments/0/left/object").length, "arguments/0/left") === _rec8._capt(_rec8._capt(ary2, "arguments/0/right/object").length, "arguments/0/right"), "arguments/0"), { - content: "assert(ary1.length === ary2.length)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 19 -})); -assert(_rec9._expr(_rec9._capt(_rec9._capt(foo, "arguments/0/left") instanceof _rec9._capt(Foo, "arguments/0/right"), "arguments/0"), { - content: "assert(foo instanceof Foo)", - filepath: "test/fixtures/BinaryExpression/fixture.js", - line: 21 -})); +assert(_ag._rec(4 !== 4, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(fuga, "arguments/0/left") !== 4, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(fuga, "arguments/0/left") === _ag3._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(fuga, "arguments/0/left") === _ag4._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(fuga, "arguments/0/left") === _ag5._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(fuga, "arguments/0/left") !== _ag6._tap(piyo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am6, -1)); +assert.ok(_ag7._rec(_ag7._tap(hoge, "arguments/0/left") === _ag7._tap(fuga, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am7, 1, 'comment')); +assert(_ag8._rec(_ag8._tap(_ag8._tap(ary1, "arguments/0/left/object").length, "arguments/0/left") === _ag8._tap(_ag8._tap(ary2, "arguments/0/right/object").length, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag9._rec(_ag9._tap(foo, "arguments/0/left") instanceof _ag9._tap(Foo, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am9, -1)); diff --git a/test/fixtures/CallExpression/expected-presets-env.js b/test/fixtures/CallExpression/expected-presets-env.js index e90ff2b..d802e2c 100644 --- a/test/fixtures/CallExpression/expected-presets-env.js +++ b/test/fixtures/CallExpression/expected-presets-env.js @@ -1,112 +1,94 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(func(), "arguments/0"), { - content: "assert(func())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(func())", "test/fixtures/CallExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"func\",\"range\":[7,11]},\"arguments\":[],\"range\":[7,13]}],\"range\":[0,14]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"func\",\"range\":[7,11]},{\"type\":{\"label\":\"(\"},\"range\":[11,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]},{\"type\":{\"label\":\")\"},\"range\":[13,14]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(obj, "arguments/0/callee/object").age(), "arguments/0"), { - content: "assert(obj.age())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(obj.age())", "test/fixtures/CallExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"obj\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"age\",\"range\":[11,14]},\"computed\":false,\"range\":[7,14]},\"arguments\":[],\"range\":[7,16]}],\"range\":[0,17]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"obj\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"age\",\"range\":[11,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(isFalsy(_rec3._capt(positiveInt, "arguments/0/arguments/0")), "arguments/0"), { - content: "assert(isFalsy(positiveInt))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(isFalsy(positiveInt))", "test/fixtures/CallExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"isFalsy\",\"range\":[7,14]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"positiveInt\",\"range\":[15,26]}],\"range\":[7,27]}],\"range\":[0,28]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"isFalsy\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"positiveInt\",\"range\":[15,26]},{\"type\":{\"label\":\")\"},\"range\":[26,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(foo, "arguments/0/callee/object")[_rec4._capt(propName, "arguments/0/callee/property")](), "arguments/0"), { - content: "assert(foo[propName]())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(foo[propName]())", "test/fixtures/CallExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[11,19]},\"computed\":true,\"range\":[7,20]},\"arguments\":[],\"range\":[7,22]}],\"range\":[0,23]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[11,19]},{\"type\":{\"label\":\"]\"},\"range\":[19,20]},{\"type\":{\"label\":\"(\"},\"range\":[20,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(foo, "arguments/0/callee/object")[_rec5._capt(_rec5._capt(hoge, "arguments/0/callee/property/object")[_rec5._capt(_rec5._capt(fuga, "arguments/0/callee/property/property/object")[_rec5._capt(piyo, "arguments/0/callee/property/property/property")], "arguments/0/callee/property/property")], "arguments/0/callee/property")](), "arguments/0"), { - content: "assert(foo[hoge[fuga[piyo]]]())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(foo[hoge[fuga[piyo]]]())", "test/fixtures/CallExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[11,15]},\"property\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[16,20]},\"property\":{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[21,25]},\"computed\":true,\"range\":[16,26]},\"computed\":true,\"range\":[11,27]},\"computed\":true,\"range\":[7,28]},\"arguments\":[],\"range\":[7,30]}],\"range\":[0,31]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[11,15]},{\"type\":{\"label\":\"[\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[16,20]},{\"type\":{\"label\":\"[\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[21,25]},{\"type\":{\"label\":\"]\"},\"range\":[25,26]},{\"type\":{\"label\":\"]\"},\"range\":[26,27]},{\"type\":{\"label\":\"]\"},\"range\":[27,28]},{\"type\":{\"label\":\"(\"},\"range\":[28,29]},{\"type\":{\"label\":\")\"},\"range\":[29,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(sum(_rec6._capt(one, "arguments/0/left/arguments/0"), _rec6._capt(two, "arguments/0/left/arguments/1"), _rec6._capt(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _rec6._capt(seven, "arguments/0/right"), "arguments/0"), { - content: "assert(sum(one, two, three) === seven)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 13, +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(sum(one, two, three) === seven)", "test/fixtures/CallExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[7,10]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"one\",\"range\":[11,14]},{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[16,19]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[21,26]}],\"range\":[7,27]},\"right\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[32,37]},\"range\":[7,37]}],\"range\":[0,38]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[7,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[11,14]},{\"type\":{\"label\":\",\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[16,19]},{\"type\":{\"label\":\",\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[21,26]},{\"type\":{\"label\":\")\"},\"range\":[26,27]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[28,31]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[32,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[7,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[11,14]},{\"type\":{\"label\":\",\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[16,19]},{\"type\":{\"label\":\",\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[21,26]},{\"type\":{\"label\":\")\"},\"range\":[26,27]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[28,31]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[32,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec7._expr(_rec7._capt(_rec7._capt(sum(_rec7._capt(sum(_rec7._capt(one, "arguments/0/left/arguments/0/arguments/0"), _rec7._capt(two, "arguments/0/left/arguments/0/arguments/1")), "arguments/0/left/arguments/0"), _rec7._capt(three, "arguments/0/left/arguments/1")), "arguments/0/left") === _rec7._capt(sum(_rec7._capt(sum(_rec7._capt(two, "arguments/0/right/arguments/0/arguments/0"), _rec7._capt(three, "arguments/0/right/arguments/0/arguments/1")), "arguments/0/right/arguments/0"), _rec7._capt(seven, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(sum(sum(one, two), three) === sum(sum(two, three), seven))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 15, +}), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(0, "assert(sum(sum(one, two), three) === sum(sum(two, three), seven))", "test/fixtures/CallExpression/fixture.js", 15, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[7,10]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[11,14]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"one\",\"range\":[15,18]},{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[20,23]}],\"range\":[11,24]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[26,31]}],\"range\":[7,32]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[37,40]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[41,44]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[45,48]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[50,55]}],\"range\":[41,56]},{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[58,63]}],\"range\":[37,64]},\"range\":[7,64]}],\"range\":[0,65]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[7,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[11,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[15,18]},{\"type\":{\"label\":\",\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[20,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[26,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[33,36]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[37,40]},{\"type\":{\"label\":\"(\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[41,44]},{\"type\":{\"label\":\"(\"},\"range\":[44,45]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[45,48]},{\"type\":{\"label\":\",\"},\"range\":[48,49]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[50,55]},{\"type\":{\"label\":\")\"},\"range\":[55,56]},{\"type\":{\"label\":\",\"},\"range\":[56,57]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[58,63]},{\"type\":{\"label\":\")\"},\"range\":[63,64]},{\"type\":{\"label\":\")\"},\"range\":[64,65]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[7,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[11,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[15,18]},{\"type\":{\"label\":\",\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[20,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[26,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[33,36]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[37,40]},{\"type\":{\"label\":\"(\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[41,44]},{\"type\":{\"label\":\"(\"},\"range\":[44,45]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[45,48]},{\"type\":{\"label\":\",\"},\"range\":[48,49]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[50,55]},{\"type\":{\"label\":\")\"},\"range\":[55,56]},{\"type\":{\"label\":\",\"},\"range\":[56,57]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[58,63]},{\"type\":{\"label\":\")\"},\"range\":[63,64]},{\"type\":{\"label\":\")\"},\"range\":[64,65]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt(math, "arguments/0/left/callee/object/object").calc, "arguments/0/left/callee/object").sum(_rec8._capt(one, "arguments/0/left/arguments/0"), _rec8._capt(two, "arguments/0/left/arguments/1"), _rec8._capt(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _rec8._capt(seven, "arguments/0/right"), "arguments/0"), { - content: "assert(math.calc.sum(one, two, three) === seven)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 17, +}), + _ag7 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(math.calc.sum(one, two, three) === seven)", "test/fixtures/CallExpression/fixture.js", 17, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"math\",\"range\":[7,11]},\"property\":{\"type\":\"Identifier\",\"name\":\"calc\",\"range\":[12,16]},\"computed\":false,\"range\":[7,16]},\"property\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[17,20]},\"computed\":false,\"range\":[7,20]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"one\",\"range\":[21,24]},{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[26,29]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[31,36]}],\"range\":[7,37]},\"right\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[42,47]},\"range\":[7,47]}],\"range\":[0,48]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"math\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"calc\",\"range\":[12,16]},{\"type\":{\"label\":\".\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[17,20]},{\"type\":{\"label\":\"(\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[26,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[31,36]},{\"type\":{\"label\":\")\"},\"range\":[36,37]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[38,41]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[42,47]},{\"type\":{\"label\":\")\"},\"range\":[47,48]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"math\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"calc\",\"range\":[12,16]},{\"type\":{\"label\":\".\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[17,20]},{\"type\":{\"label\":\"(\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[26,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[31,36]},{\"type\":{\"label\":\")\"},\"range\":[36,37]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[38,41]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[42,47]},{\"type\":{\"label\":\")\"},\"range\":[47,48]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec9._expr(_rec9._capt(_rec9._capt(_rec9._capt(three, "arguments/0/left/left") * _rec9._capt(_rec9._capt(seven, "arguments/0/left/right/left") * _rec9._capt(ten, "arguments/0/left/right/right"), "arguments/0/left/right"), "arguments/0/left") === _rec9._capt(three, "arguments/0/right"), "arguments/0"), { - content: "assert(three * (seven * ten) === three)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 19, +}), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert(three * (seven * ten) === three)", "test/fixtures/CallExpression/fixture.js", 19, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[7,12]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[16,21]},\"right\":{\"type\":\"Identifier\",\"name\":\"ten\",\"range\":[24,27]},\"range\":[16,27]},\"range\":[7,28]},\"right\":{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[33,38]},\"range\":[7,38]}],\"range\":[0,39]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[7,12]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[13,14]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[16,21]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"ten\",\"range\":[24,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[29,32]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[33,38]},{\"type\":{\"label\":\")\"},\"range\":[38,39]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[7,12]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[13,14]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[16,21]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"ten\",\"range\":[24,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[29,32]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[33,38]},{\"type\":{\"label\":\")\"},\"range\":[38,39]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec10._expr(_rec10._capt(!_rec10._capt(concat(_rec10._capt(fuga, "arguments/0/argument/arguments/0"), _rec10._capt(piyo, "arguments/0/argument/arguments/1")), "arguments/0/argument"), "arguments/0"), { - content: "assert(!concat(fuga, piyo))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 21, +}), + _ag9 = new _ArgumentRecorder(assert, _am9, 0), + _am10 = _pwmeta(0, "assert(!concat(fuga, piyo))", "test/fixtures/CallExpression/fixture.js", 21, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"concat\",\"range\":[8,14]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[15,19]},{\"type\":\"Identifier\",\"name\":\"piyo\",\"range\":[21,25]}],\"range\":[8,26]},\"prefix\":true,\"range\":[7,26]}],\"range\":[0,27]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"concat\",\"range\":[8,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[15,19]},{\"type\":{\"label\":\",\"},\"range\":[19,20]},{\"type\":{\"label\":\"name\"},\"value\":\"piyo\",\"range\":[21,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]},{\"type\":{\"label\":\")\"},\"range\":[26,27]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.strictEqual(_rec11._expr(_rec11._capt(_rec11._capt(three, "arguments/0/left") * _rec11._capt(_rec11._capt(seven, "arguments/0/right/left") * _rec11._capt(ten, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), { - content: "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 23, +}), + _ag10 = new _ArgumentRecorder(assert, _am10, 0), + _am11 = _pwmeta(4, "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", "test/fixtures/CallExpression/fixture.js", 23, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[19,24]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[28,33]},\"right\":{\"type\":\"Identifier\",\"name\":\"ten\",\"range\":[36,39]},\"range\":[28,39]},\"range\":[19,40]},{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"math\",\"range\":[42,46]},\"property\":{\"type\":\"Identifier\",\"name\":\"calc\",\"range\":[47,51]},\"computed\":false,\"range\":[42,51]},\"property\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[52,55]},\"computed\":false,\"range\":[42,55]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"one\",\"range\":[56,59]},{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[61,64]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[66,71]}],\"range\":[42,72]}],\"range\":[0,73]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[19,24]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[25,26]},{\"type\":{\"label\":\"(\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[28,33]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"ten\",\"range\":[36,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\",\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"math\",\"range\":[42,46]},{\"type\":{\"label\":\".\"},\"range\":[46,47]},{\"type\":{\"label\":\"name\"},\"value\":\"calc\",\"range\":[47,51]},{\"type\":{\"label\":\".\"},\"range\":[51,52]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[52,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[56,59]},{\"type\":{\"label\":\",\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[61,64]},{\"type\":{\"label\":\",\"},\"range\":[64,65]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[66,71]},{\"type\":{\"label\":\")\"},\"range\":[71,72]},{\"type\":{\"label\":\")\"},\"range\":[72,73]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec12._expr(_rec12._capt(_rec12._capt(_rec12._capt(math, "arguments/1/callee/object/object").calc, "arguments/1/callee/object").sum(_rec12._capt(one, "arguments/1/arguments/0"), _rec12._capt(two, "arguments/1/arguments/1"), _rec12._capt(three, "arguments/1/arguments/2")), "arguments/1"), { - content: "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 23, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[19,24]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"*\",\"left\":{\"type\":\"Identifier\",\"name\":\"seven\",\"range\":[28,33]},\"right\":{\"type\":\"Identifier\",\"name\":\"ten\",\"range\":[36,39]},\"range\":[28,39]},\"range\":[19,40]},{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"math\",\"range\":[42,46]},\"property\":{\"type\":\"Identifier\",\"name\":\"calc\",\"range\":[47,51]},\"computed\":false,\"range\":[42,51]},\"property\":{\"type\":\"Identifier\",\"name\":\"sum\",\"range\":[52,55]},\"computed\":false,\"range\":[42,55]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"one\",\"range\":[56,59]},{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[61,64]},{\"type\":\"Identifier\",\"name\":\"three\",\"range\":[66,71]}],\"range\":[42,72]}],\"range\":[0,73]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[19,24]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[25,26]},{\"type\":{\"label\":\"(\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"seven\",\"range\":[28,33]},{\"type\":{\"label\":\"*\"},\"value\":\"*\",\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"ten\",\"range\":[36,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\",\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"math\",\"range\":[42,46]},{\"type\":{\"label\":\".\"},\"range\":[46,47]},{\"type\":{\"label\":\"name\"},\"value\":\"calc\",\"range\":[47,51]},{\"type\":{\"label\":\".\"},\"range\":[51,52]},{\"type\":{\"label\":\"name\"},\"value\":\"sum\",\"range\":[52,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"one\",\"range\":[56,59]},{\"type\":{\"label\":\",\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[61,64]},{\"type\":{\"label\":\",\"},\"range\":[64,65]},{\"type\":{\"label\":\"name\"},\"value\":\"three\",\"range\":[66,71]},{\"type\":{\"label\":\")\"},\"range\":[71,72]},{\"type\":{\"label\":\")\"},\"range\":[72,73]}]", - visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag11 = new _ArgumentRecorder(assert.strictEqual, _am11, 0), + _ag12 = new _ArgumentRecorder(assert.strictEqual, _am11, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(func(), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(obj, "arguments/0/callee/object").age(), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(isFalsy(_ag3._tap(positiveInt, "arguments/0/arguments/0")), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(foo, "arguments/0/callee/object")[_ag4._tap(propName, "arguments/0/callee/property")](), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(foo, "arguments/0/callee/object")[_ag5._tap(_ag5._tap(hoge, "arguments/0/callee/property/object")[_ag5._tap(_ag5._tap(fuga, "arguments/0/callee/property/property/object")[_ag5._tap(piyo, "arguments/0/callee/property/property/property")], "arguments/0/callee/property/property")], "arguments/0/callee/property")](), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(sum(_ag6._tap(one, "arguments/0/left/arguments/0"), _ag6._tap(two, "arguments/0/left/arguments/1"), _ag6._tap(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _ag6._tap(seven, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am6, -1)); +assert(_ag7._rec(_ag7._tap(sum(_ag7._tap(sum(_ag7._tap(one, "arguments/0/left/arguments/0/arguments/0"), _ag7._tap(two, "arguments/0/left/arguments/0/arguments/1")), "arguments/0/left/arguments/0"), _ag7._tap(three, "arguments/0/left/arguments/1")), "arguments/0/left") === _ag7._tap(sum(_ag7._tap(sum(_ag7._tap(two, "arguments/0/right/arguments/0/arguments/0"), _ag7._tap(three, "arguments/0/right/arguments/0/arguments/1")), "arguments/0/right/arguments/0"), _ag7._tap(seven, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag8._rec(_ag8._tap(_ag8._tap(_ag8._tap(math, "arguments/0/left/callee/object/object").calc, "arguments/0/left/callee/object").sum(_ag8._tap(one, "arguments/0/left/arguments/0"), _ag8._tap(two, "arguments/0/left/arguments/1"), _ag8._tap(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _ag8._tap(seven, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag9._rec(_ag9._tap(_ag9._tap(three, "arguments/0/left/left") * _ag9._tap(_ag9._tap(seven, "arguments/0/left/right/left") * _ag9._tap(ten, "arguments/0/left/right/right"), "arguments/0/left/right"), "arguments/0/left") === _ag9._tap(three, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am9, -1)); +assert(_ag10._rec(!_ag10._tap(concat(_ag10._tap(fuga, "arguments/0/argument/arguments/0"), _ag10._tap(piyo, "arguments/0/argument/arguments/1")), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am10, -1)); +assert.strictEqual(_ag11._rec(_ag11._tap(three, "arguments/0/left") * _ag11._tap(_ag11._tap(seven, "arguments/0/right/left") * _ag11._tap(ten, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), _ag12._rec(_ag12._tap(_ag12._tap(math, "arguments/1/callee/object/object").calc, "arguments/1/callee/object").sum(_ag12._tap(one, "arguments/1/arguments/0"), _ag12._tap(two, "arguments/1/arguments/1"), _ag12._tap(three, "arguments/1/arguments/2")), "arguments/1"), new _AssertionMessage(_am11, -1)); diff --git a/test/fixtures/CallExpression/expected.js b/test/fixtures/CallExpression/expected.js index c724789..25fd1d7 100644 --- a/test/fixtures/CallExpression/expected.js +++ b/test/fixtures/CallExpression/expected.js @@ -1,75 +1,41 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(func())", "test/fixtures/CallExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(obj.age())", "test/fixtures/CallExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(isFalsy(positiveInt))", "test/fixtures/CallExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(foo[propName]())", "test/fixtures/CallExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(foo[hoge[fuga[piyo]]]())", "test/fixtures/CallExpression/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(sum(one, two, three) === seven)", "test/fixtures/CallExpression/fixture.js", 13), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(0, "assert(sum(sum(one, two), three) === sum(sum(two, three), seven))", "test/fixtures/CallExpression/fixture.js", 15), + _ag7 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(math.calc.sum(one, two, three) === seven)", "test/fixtures/CallExpression/fixture.js", 17), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert(three * (seven * ten) === three)", "test/fixtures/CallExpression/fixture.js", 19), + _ag9 = new _ArgumentRecorder(assert, _am9, 0), + _am10 = _pwmeta(0, "assert(!concat(fuga, piyo))", "test/fixtures/CallExpression/fixture.js", 21), + _ag10 = new _ArgumentRecorder(assert, _am10, 0), + _am11 = _pwmeta(4, "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", "test/fixtures/CallExpression/fixture.js", 23), + _ag11 = new _ArgumentRecorder(assert.strictEqual, _am11, 0), + _ag12 = new _ArgumentRecorder(assert.strictEqual, _am11, 1); -assert(_rec._expr(_rec._capt(func(), "arguments/0"), { - content: "assert(func())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(obj, "arguments/0/callee/object").age(), "arguments/0"), { - content: "assert(obj.age())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(isFalsy(_rec3._capt(positiveInt, "arguments/0/arguments/0")), "arguments/0"), { - content: "assert(isFalsy(positiveInt))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(foo, "arguments/0/callee/object")[_rec4._capt(propName, "arguments/0/callee/property")](), "arguments/0"), { - content: "assert(foo[propName]())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 9 -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(foo, "arguments/0/callee/object")[_rec5._capt(_rec5._capt(hoge, "arguments/0/callee/property/object")[_rec5._capt(_rec5._capt(fuga, "arguments/0/callee/property/property/object")[_rec5._capt(piyo, "arguments/0/callee/property/property/property")], "arguments/0/callee/property/property")], "arguments/0/callee/property")](), "arguments/0"), { - content: "assert(foo[hoge[fuga[piyo]]]())", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 11 -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(sum(_rec6._capt(one, "arguments/0/left/arguments/0"), _rec6._capt(two, "arguments/0/left/arguments/1"), _rec6._capt(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _rec6._capt(seven, "arguments/0/right"), "arguments/0"), { - content: "assert(sum(one, two, three) === seven)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 13 -})); -assert(_rec7._expr(_rec7._capt(_rec7._capt(sum(_rec7._capt(sum(_rec7._capt(one, "arguments/0/left/arguments/0/arguments/0"), _rec7._capt(two, "arguments/0/left/arguments/0/arguments/1")), "arguments/0/left/arguments/0"), _rec7._capt(three, "arguments/0/left/arguments/1")), "arguments/0/left") === _rec7._capt(sum(_rec7._capt(sum(_rec7._capt(two, "arguments/0/right/arguments/0/arguments/0"), _rec7._capt(three, "arguments/0/right/arguments/0/arguments/1")), "arguments/0/right/arguments/0"), _rec7._capt(seven, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(sum(sum(one, two), three) === sum(sum(two, three), seven))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 15 -})); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt(math, "arguments/0/left/callee/object/object").calc, "arguments/0/left/callee/object").sum(_rec8._capt(one, "arguments/0/left/arguments/0"), _rec8._capt(two, "arguments/0/left/arguments/1"), _rec8._capt(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _rec8._capt(seven, "arguments/0/right"), "arguments/0"), { - content: "assert(math.calc.sum(one, two, three) === seven)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 17 -})); -assert(_rec9._expr(_rec9._capt(_rec9._capt(_rec9._capt(three, "arguments/0/left/left") * _rec9._capt(_rec9._capt(seven, "arguments/0/left/right/left") * _rec9._capt(ten, "arguments/0/left/right/right"), "arguments/0/left/right"), "arguments/0/left") === _rec9._capt(three, "arguments/0/right"), "arguments/0"), { - content: "assert(three * (seven * ten) === three)", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 19 -})); -assert(_rec10._expr(_rec10._capt(!_rec10._capt(concat(_rec10._capt(fuga, "arguments/0/argument/arguments/0"), _rec10._capt(piyo, "arguments/0/argument/arguments/1")), "arguments/0/argument"), "arguments/0"), { - content: "assert(!concat(fuga, piyo))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 21 -})); -assert.strictEqual(_rec11._expr(_rec11._capt(_rec11._capt(three, "arguments/0/left") * _rec11._capt(_rec11._capt(seven, "arguments/0/right/left") * _rec11._capt(ten, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), { - content: "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 23 -}), _rec12._expr(_rec12._capt(_rec12._capt(_rec12._capt(math, "arguments/1/callee/object/object").calc, "arguments/1/callee/object").sum(_rec12._capt(one, "arguments/1/arguments/0"), _rec12._capt(two, "arguments/1/arguments/1"), _rec12._capt(three, "arguments/1/arguments/2")), "arguments/1"), { - content: "assert.strictEqual(three * (seven * ten), math.calc.sum(one, two, three))", - filepath: "test/fixtures/CallExpression/fixture.js", - line: 23 -})); +assert(_ag._rec(func(), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(obj, "arguments/0/callee/object").age(), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(isFalsy(_ag3._tap(positiveInt, "arguments/0/arguments/0")), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(foo, "arguments/0/callee/object")[_ag4._tap(propName, "arguments/0/callee/property")](), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(foo, "arguments/0/callee/object")[_ag5._tap(_ag5._tap(hoge, "arguments/0/callee/property/object")[_ag5._tap(_ag5._tap(fuga, "arguments/0/callee/property/property/object")[_ag5._tap(piyo, "arguments/0/callee/property/property/property")], "arguments/0/callee/property/property")], "arguments/0/callee/property")](), "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(sum(_ag6._tap(one, "arguments/0/left/arguments/0"), _ag6._tap(two, "arguments/0/left/arguments/1"), _ag6._tap(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _ag6._tap(seven, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am6, -1)); +assert(_ag7._rec(_ag7._tap(sum(_ag7._tap(sum(_ag7._tap(one, "arguments/0/left/arguments/0/arguments/0"), _ag7._tap(two, "arguments/0/left/arguments/0/arguments/1")), "arguments/0/left/arguments/0"), _ag7._tap(three, "arguments/0/left/arguments/1")), "arguments/0/left") === _ag7._tap(sum(_ag7._tap(sum(_ag7._tap(two, "arguments/0/right/arguments/0/arguments/0"), _ag7._tap(three, "arguments/0/right/arguments/0/arguments/1")), "arguments/0/right/arguments/0"), _ag7._tap(seven, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag8._rec(_ag8._tap(_ag8._tap(_ag8._tap(math, "arguments/0/left/callee/object/object").calc, "arguments/0/left/callee/object").sum(_ag8._tap(one, "arguments/0/left/arguments/0"), _ag8._tap(two, "arguments/0/left/arguments/1"), _ag8._tap(three, "arguments/0/left/arguments/2")), "arguments/0/left") === _ag8._tap(seven, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag9._rec(_ag9._tap(_ag9._tap(three, "arguments/0/left/left") * _ag9._tap(_ag9._tap(seven, "arguments/0/left/right/left") * _ag9._tap(ten, "arguments/0/left/right/right"), "arguments/0/left/right"), "arguments/0/left") === _ag9._tap(three, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am9, -1)); +assert(_ag10._rec(!_ag10._tap(concat(_ag10._tap(fuga, "arguments/0/argument/arguments/0"), _ag10._tap(piyo, "arguments/0/argument/arguments/1")), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am10, -1)); +assert.strictEqual(_ag11._rec(_ag11._tap(three, "arguments/0/left") * _ag11._tap(_ag11._tap(seven, "arguments/0/right/left") * _ag11._tap(ten, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), _ag12._rec(_ag12._tap(_ag12._tap(math, "arguments/1/callee/object/object").calc, "arguments/1/callee/object").sum(_ag12._tap(one, "arguments/1/arguments/0"), _ag12._tap(two, "arguments/1/arguments/1"), _ag12._tap(three, "arguments/1/arguments/2")), "arguments/1"), new _AssertionMessage(_am11, -1)); diff --git a/test/fixtures/ClassExpression/expected-presets-env.js b/test/fixtures/ClassExpression/expected-presets-env.js index 47f0c76..1562758 100644 --- a/test/fixtures/ClassExpression/expected-presets-env.js +++ b/test/fixtures/ClassExpression/expected-presets-env.js @@ -1,6 +1,13 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}"; +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(class Me { getClassName() { return foo + Me.name; } })", "test/fixtures/ClassExpression/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ClassExpression\",\"id\":{\"type\":\"Identifier\",\"name\":\"Me\",\"range\":[13,15]},\"superClass\":null,\"body\":{\"type\":\"ClassBody\",\"body\":[{\"type\":\"ClassMethod\",\"kind\":\"method\",\"key\":{\"type\":\"Identifier\",\"name\":\"getClassName\",\"range\":[18,30]},\"params\":[],\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[42,45]},\"right\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"Me\",\"range\":[48,50]},\"property\":{\"type\":\"Identifier\",\"name\":\"name\",\"range\":[51,55]},\"computed\":false,\"range\":[48,55]},\"range\":[42,55]},\"range\":[35,56]}],\"directives\":[],\"range\":[33,58]},\"computed\":false,\"static\":false,\"range\":[18,58]}],\"range\":[16,60]},\"range\":[7,60]}],\"range\":[0,61]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"class\"},\"value\":\"class\",\"range\":[7,12]},{\"type\":{\"label\":\"name\"},\"value\":\"Me\",\"range\":[13,15]},{\"type\":{\"label\":\"{\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"getClassName\",\"range\":[18,30]},{\"type\":{\"label\":\"(\"},\"range\":[30,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\"{\"},\"range\":[33,34]},{\"type\":{\"label\":\"return\"},\"value\":\"return\",\"range\":[35,41]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[42,45]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[46,47]},{\"type\":{\"label\":\"name\"},\"value\":\"Me\",\"range\":[48,50]},{\"type\":{\"label\":\".\"},\"range\":[50,51]},{\"type\":{\"label\":\"name\"},\"value\":\"name\",\"range\":[51,55]},{\"type\":{\"label\":\";\"},\"range\":[55,56]},{\"type\":{\"label\":\"}\"},\"range\":[57,58]},{\"type\":{\"label\":\"}\"},\"range\":[59,60]},{\"type\":{\"label\":\")\"},\"range\":[60,61]}]", + visitorKeys: _powerAssertVisitorKeys +}); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } diff --git a/test/fixtures/ClassExpression/expected.js b/test/fixtures/ClassExpression/expected.js index 15cab32..6b1e47d 100644 --- a/test/fixtures/ClassExpression/expected.js +++ b/test/fixtures/ClassExpression/expected.js @@ -1,5 +1,9 @@ 'use strict'; +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(class Me { getClassName() { return foo + Me.name; } })", "test/fixtures/ClassExpression/fixture.js", 3); + assert(class Me { getClassName() { return foo + Me.name; diff --git a/test/fixtures/CommentsInAssertion/expected.js b/test/fixtures/CommentsInAssertion/expected.js index 7c80926..bb77083 100644 --- a/test/fixtures/CommentsInAssertion/expected.js +++ b/test/fixtures/CommentsInAssertion/expected.js @@ -1,18 +1,14 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/CommentsInAssertion/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert.equal, _am, 0), + _ag2 = new _ArgumentRecorder(assert.equal, _am, 1), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); assert.equal( // first comment -_rec._expr(_rec._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/CommentsInAssertion/fixture.js", - line: 3 -}), // second comment -_rec2._expr(_rec2._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/CommentsInAssertion/fixture.js", - line: 3 -}) // last comment -); +_ag._rec(str, "arguments/0"), // second comment +_ag2._rec(anotherStr, "arguments/1") // last comment +, new _AssertionMessage(_am, -1)); diff --git a/test/fixtures/ConditionalExpression/expected-presets-env.js b/test/fixtures/ConditionalExpression/expected-presets-env.js index 5d7eed9..35a2e24 100644 --- a/test/fixtures/ConditionalExpression/expected-presets-env.js +++ b/test/fixtures/ConditionalExpression/expected-presets-env.js @@ -1,51 +1,45 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -assert(_rec._expr(_rec._capt(foo, "arguments/0/test") ? _rec._capt(bar, "arguments/0/consequent") : _rec._capt(baz, "arguments/0/alternate"), { - content: "assert(foo ? bar : baz)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(foo ? bar : baz)", "test/fixtures/ConditionalExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[13,16]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[19,22]},\"range\":[7,22]}],\"range\":[0,23]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"?\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[13,16]},{\"type\":{\"label\":\":\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[19,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(falsy, "arguments/0/test") ? _rec2._capt(truthy, "arguments/0/consequent") : _rec2._capt(truthy, "arguments/0/alternate/test") ? _rec2._capt(anotherFalsy, "arguments/0/alternate/consequent") : _rec2._capt(truthy, "arguments/0/alternate/alternate"), { - content: "assert(falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(falsy ? truthy : truthy ? anotherFalsy : truthy)", "test/fixtures/ConditionalExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"falsy\",\"range\":[7,12]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[15,21]},\"alternate\":{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[24,30]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"anotherFalsy\",\"range\":[33,45]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[48,54]},\"range\":[24,54]},\"range\":[7,54]}],\"range\":[0,55]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[7,12]},{\"type\":{\"label\":\"?\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[15,21]},{\"type\":{\"label\":\":\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[24,30]},{\"type\":{\"label\":\"?\"},\"range\":[31,32]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherFalsy\",\"range\":[33,45]},{\"type\":{\"label\":\":\"},\"range\":[46,47]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[48,54]},{\"type\":{\"label\":\")\"},\"range\":[54,55]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(foo(), "arguments/0/test") ? _rec3._capt(_rec3._capt(bar, "arguments/0/consequent/object").baz, "arguments/0/consequent") : _rec3._capt(typeof goo === "undefined" ? "undefined" : _typeof(goo), "arguments/0/alternate"), { - content: "assert(foo() ? bar.baz : typeof goo)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(foo() ? bar.baz : typeof goo)", "test/fixtures/ConditionalExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"arguments\":[],\"range\":[7,12]},\"consequent\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[15,18]},\"property\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[19,22]},\"computed\":false,\"range\":[15,22]},\"alternate\":{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"goo\",\"range\":[32,35]},\"prefix\":true,\"range\":[25,35]},\"range\":[7,35]}],\"range\":[0,36]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\")\"},\"range\":[11,12]},{\"type\":{\"label\":\"?\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[15,18]},{\"type\":{\"label\":\".\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[19,22]},{\"type\":{\"label\":\":\"},\"range\":[23,24]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[25,31]},{\"type\":{\"label\":\"name\"},\"value\":\"goo\",\"range\":[32,35]},{\"type\":{\"label\":\")\"},\"range\":[35,36]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec4._expr(_rec4._capt(foo, "arguments/0/test") ? _rec4._capt(bar, "arguments/0/consequent") : _rec4._capt(baz, "arguments/0/alternate"), { - content: "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 9, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[13,16]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[19,22]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[25,28]},\"range\":[13,28]},{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"falsy\",\"range\":[30,35]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[38,44]},\"alternate\":{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[47,53]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"anotherFalsy\",\"range\":[56,68]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[71,77]},\"range\":[47,77]},\"range\":[30,77]}],\"range\":[0,78]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[13,16]},{\"type\":{\"label\":\"?\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[19,22]},{\"type\":{\"label\":\":\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[25,28]},{\"type\":{\"label\":\",\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[30,35]},{\"type\":{\"label\":\"?\"},\"range\":[36,37]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[38,44]},{\"type\":{\"label\":\":\"},\"range\":[45,46]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[47,53]},{\"type\":{\"label\":\"?\"},\"range\":[54,55]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherFalsy\",\"range\":[56,68]},{\"type\":{\"label\":\":\"},\"range\":[69,70]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[71,77]},{\"type\":{\"label\":\")\"},\"range\":[77,78]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec5._expr(_rec5._capt(falsy, "arguments/1/test") ? _rec5._capt(truthy, "arguments/1/consequent") : _rec5._capt(truthy, "arguments/1/alternate/test") ? _rec5._capt(anotherFalsy, "arguments/1/alternate/consequent") : _rec5._capt(truthy, "arguments/1/alternate/alternate"), { - content: "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(2, "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", "test/fixtures/ConditionalExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[13,16]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[19,22]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[25,28]},\"range\":[13,28]},{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"falsy\",\"range\":[30,35]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[38,44]},\"alternate\":{\"type\":\"ConditionalExpression\",\"test\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[47,53]},\"consequent\":{\"type\":\"Identifier\",\"name\":\"anotherFalsy\",\"range\":[56,68]},\"alternate\":{\"type\":\"Identifier\",\"name\":\"truthy\",\"range\":[71,77]},\"range\":[47,77]},\"range\":[30,77]}],\"range\":[0,78]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[13,16]},{\"type\":{\"label\":\"?\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[19,22]},{\"type\":{\"label\":\":\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[25,28]},{\"type\":{\"label\":\",\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[30,35]},{\"type\":{\"label\":\"?\"},\"range\":[36,37]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[38,44]},{\"type\":{\"label\":\":\"},\"range\":[45,46]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[47,53]},{\"type\":{\"label\":\"?\"},\"range\":[54,55]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherFalsy\",\"range\":[56,68]},{\"type\":{\"label\":\":\"},\"range\":[69,70]},{\"type\":{\"label\":\"name\"},\"value\":\"truthy\",\"range\":[71,77]},{\"type\":{\"label\":\")\"},\"range\":[77,78]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag4 = new _ArgumentRecorder(assert.equal, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.equal, _am4, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(_ag._tap(foo, "arguments/0/test") ? _ag._tap(bar, "arguments/0/consequent") : _ag._tap(baz, "arguments/0/alternate")), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(falsy, "arguments/0/test") ? _ag2._tap(truthy, "arguments/0/consequent") : _ag2._tap(truthy, "arguments/0/alternate/test") ? _ag2._tap(anotherFalsy, "arguments/0/alternate/consequent") : _ag2._tap(truthy, "arguments/0/alternate/alternate")), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(foo(), "arguments/0/test") ? _ag3._tap(_ag3._tap(bar, "arguments/0/consequent/object").baz, "arguments/0/consequent") : _ag3._tap(typeof goo === "undefined" ? "undefined" : _typeof(goo), "arguments/0/alternate")), new _AssertionMessage(_am3, -1)); +assert.equal(_ag4._rec(_ag4._tap(foo, "arguments/0/test") ? _ag4._tap(bar, "arguments/0/consequent") : _ag4._tap(baz, "arguments/0/alternate")), _ag5._rec(_ag5._tap(falsy, "arguments/1/test") ? _ag5._tap(truthy, "arguments/1/consequent") : _ag5._tap(truthy, "arguments/1/alternate/test") ? _ag5._tap(anotherFalsy, "arguments/1/alternate/consequent") : _ag5._tap(truthy, "arguments/1/alternate/alternate")), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/ConditionalExpression/expected.js b/test/fixtures/ConditionalExpression/expected.js index 8de25ce..9fcb231 100644 --- a/test/fixtures/ConditionalExpression/expected.js +++ b/test/fixtures/ConditionalExpression/expected.js @@ -1,33 +1,20 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(foo ? bar : baz)", "test/fixtures/ConditionalExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(falsy ? truthy : truthy ? anotherFalsy : truthy)", "test/fixtures/ConditionalExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(foo() ? bar.baz : typeof goo)", "test/fixtures/ConditionalExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(2, "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", "test/fixtures/ConditionalExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert.equal, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.equal, _am4, 1); -assert(_rec._expr(_rec._capt(foo, "arguments/0/test") ? _rec._capt(bar, "arguments/0/consequent") : _rec._capt(baz, "arguments/0/alternate"), { - content: "assert(foo ? bar : baz)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(falsy, "arguments/0/test") ? _rec2._capt(truthy, "arguments/0/consequent") : _rec2._capt(truthy, "arguments/0/alternate/test") ? _rec2._capt(anotherFalsy, "arguments/0/alternate/consequent") : _rec2._capt(truthy, "arguments/0/alternate/alternate"), { - content: "assert(falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(foo(), "arguments/0/test") ? _rec3._capt(_rec3._capt(bar, "arguments/0/consequent/object").baz, "arguments/0/consequent") : _rec3._capt(typeof goo, "arguments/0/alternate"), { - content: "assert(foo() ? bar.baz : typeof goo)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 7 -})); -assert.equal(_rec4._expr(_rec4._capt(foo, "arguments/0/test") ? _rec4._capt(bar, "arguments/0/consequent") : _rec4._capt(baz, "arguments/0/alternate"), { - content: "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 9 -}), _rec5._expr(_rec5._capt(falsy, "arguments/1/test") ? _rec5._capt(truthy, "arguments/1/consequent") : _rec5._capt(truthy, "arguments/1/alternate/test") ? _rec5._capt(anotherFalsy, "arguments/1/alternate/consequent") : _rec5._capt(truthy, "arguments/1/alternate/alternate"), { - content: "assert.equal(foo ? bar : baz, falsy ? truthy : truthy ? anotherFalsy : truthy)", - filepath: "test/fixtures/ConditionalExpression/fixture.js", - line: 9 -})); +assert(_ag._rec(_ag._tap(foo, "arguments/0/test") ? _ag._tap(bar, "arguments/0/consequent") : _ag._tap(baz, "arguments/0/alternate")), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(falsy, "arguments/0/test") ? _ag2._tap(truthy, "arguments/0/consequent") : _ag2._tap(truthy, "arguments/0/alternate/test") ? _ag2._tap(anotherFalsy, "arguments/0/alternate/consequent") : _ag2._tap(truthy, "arguments/0/alternate/alternate")), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(foo(), "arguments/0/test") ? _ag3._tap(_ag3._tap(bar, "arguments/0/consequent/object").baz, "arguments/0/consequent") : _ag3._tap(typeof goo, "arguments/0/alternate")), new _AssertionMessage(_am3, -1)); +assert.equal(_ag4._rec(_ag4._tap(foo, "arguments/0/test") ? _ag4._tap(bar, "arguments/0/consequent") : _ag4._tap(baz, "arguments/0/alternate")), _ag5._rec(_ag5._tap(falsy, "arguments/1/test") ? _ag5._tap(truthy, "arguments/1/consequent") : _ag5._tap(truthy, "arguments/1/alternate/test") ? _ag5._tap(anotherFalsy, "arguments/1/alternate/consequent") : _ag5._tap(truthy, "arguments/1/alternate/alternate")), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/FunctionExpression/expected-presets-env.js b/test/fixtures/FunctionExpression/expected-presets-env.js index fe14011..a2b1ee6 100644 --- a/test/fixtures/FunctionExpression/expected-presets-env.js +++ b/test/fixtures/FunctionExpression/expected-presets-env.js @@ -1,19 +1,33 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(function (a, b) { return a + b; })", "test/fixtures/FunctionExpression/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"FunctionExpression\",\"id\":null,\"params\":[{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[17,18]},{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[20,21]}],\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[32,33]},\"right\":{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[36,37]},\"range\":[32,37]},\"range\":[25,38]}],\"directives\":[],\"range\":[23,40]},\"generator\":false,\"async\":false,\"range\":[7,40]}],\"range\":[0,41]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"function\"},\"value\":\"function\",\"range\":[7,15]},{\"type\":{\"label\":\"(\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[17,18]},{\"type\":{\"label\":\",\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[20,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]},{\"type\":{\"label\":\"{\"},\"range\":[23,24]},{\"type\":{\"label\":\"return\"},\"value\":\"return\",\"range\":[25,31]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[32,33]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[36,37]},{\"type\":{\"label\":\";\"},\"range\":[37,38]},{\"type\":{\"label\":\"}\"},\"range\":[39,40]},{\"type\":{\"label\":\")\"},\"range\":[40,41]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am2 = _pwmeta(0, "assert(baz === function (a, b) { return a + b; }(foo, bar))", "test/fixtures/FunctionExpression/fixture.js", 5, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[7,10]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"FunctionExpression\",\"id\":null,\"params\":[{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[25,26]},{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[28,29]}],\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[40,41]},\"right\":{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[44,45]},\"range\":[40,45]},\"range\":[33,46]}],\"directives\":[],\"range\":[31,48]},\"generator\":false,\"async\":false,\"range\":[15,48]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[49,52]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[54,57]}],\"range\":[15,58]},\"range\":[7,58]}],\"range\":[0,59]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[7,10]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[11,14]},{\"type\":{\"label\":\"function\"},\"value\":\"function\",\"range\":[15,23]},{\"type\":{\"label\":\"(\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[25,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[28,29]},{\"type\":{\"label\":\")\"},\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[31,32]},{\"type\":{\"label\":\"return\"},\"value\":\"return\",\"range\":[33,39]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[40,41]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[42,43]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[44,45]},{\"type\":{\"label\":\";\"},\"range\":[45,46]},{\"type\":{\"label\":\"}\"},\"range\":[47,48]},{\"type\":{\"label\":\"(\"},\"range\":[48,49]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[49,52]},{\"type\":{\"label\":\",\"},\"range\":[52,53]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[54,57]},{\"type\":{\"label\":\")\"},\"range\":[57,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am2, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } assert(function (a, b) { return a + b; }); -assert(_rec._expr(_rec._capt(_rec._capt(baz, "arguments/0/left") === _rec._capt(function (a, b) { +assert(_ag._rec(_ag._tap(baz, "arguments/0/left") === _ag._tap(function (a, b) { return a + b; -}(_rec._capt(foo, "arguments/0/right/arguments/0"), _rec._capt(bar, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(baz === function (a, b) { return a + b; }(foo, bar))", - filepath: "test/fixtures/FunctionExpression/fixture.js", - line: 5, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[7,10]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"FunctionExpression\",\"id\":null,\"params\":[{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[25,26]},{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[28,29]}],\"body\":{\"type\":\"BlockStatement\",\"body\":[{\"type\":\"ReturnStatement\",\"argument\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[40,41]},\"right\":{\"type\":\"Identifier\",\"name\":\"b\",\"range\":[44,45]},\"range\":[40,45]},\"range\":[33,46]}],\"directives\":[],\"range\":[31,48]},\"generator\":false,\"async\":false,\"range\":[15,48]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[49,52]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[54,57]}],\"range\":[15,58]},\"range\":[7,58]}],\"range\":[0,59]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[7,10]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[11,14]},{\"type\":{\"label\":\"function\"},\"value\":\"function\",\"range\":[15,23]},{\"type\":{\"label\":\"(\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[25,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[28,29]},{\"type\":{\"label\":\")\"},\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[31,32]},{\"type\":{\"label\":\"return\"},\"value\":\"return\",\"range\":[33,39]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[40,41]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[42,43]},{\"type\":{\"label\":\"name\"},\"value\":\"b\",\"range\":[44,45]},{\"type\":{\"label\":\";\"},\"range\":[45,46]},{\"type\":{\"label\":\"}\"},\"range\":[47,48]},{\"type\":{\"label\":\"(\"},\"range\":[48,49]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[49,52]},{\"type\":{\"label\":\",\"},\"range\":[52,53]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[54,57]},{\"type\":{\"label\":\")\"},\"range\":[57,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]}]", - visitorKeys: _powerAssertVisitorKeys -})); +}(_ag._tap(foo, "arguments/0/right/arguments/0"), _ag._tap(bar, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); diff --git a/test/fixtures/FunctionExpression/expected.js b/test/fixtures/FunctionExpression/expected.js index 9129065..2601951 100644 --- a/test/fixtures/FunctionExpression/expected.js +++ b/test/fixtures/FunctionExpression/expected.js @@ -1,15 +1,16 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(function (a, b) { return a + b; })", "test/fixtures/FunctionExpression/fixture.js", 3), + _am2 = _pwmeta(0, "assert(baz === function (a, b) { return a + b; }(foo, bar))", "test/fixtures/FunctionExpression/fixture.js", 5), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am2, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); assert(function (a, b) { return a + b; }); -assert(_rec._expr(_rec._capt(_rec._capt(baz, "arguments/0/left") === _rec._capt(function (a, b) { +assert(_ag._rec(_ag._tap(baz, "arguments/0/left") === _ag._tap(function (a, b) { return a + b; -}(_rec._capt(foo, "arguments/0/right/arguments/0"), _rec._capt(bar, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), { - content: "assert(baz === function (a, b) { return a + b; }(foo, bar))", - filepath: "test/fixtures/FunctionExpression/fixture.js", - line: 5 -})); +}(_ag._tap(foo, "arguments/0/right/arguments/0"), _ag._tap(bar, "arguments/0/right/arguments/1")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); diff --git a/test/fixtures/Identifier/expected-presets-env.js b/test/fixtures/Identifier/expected-presets-env.js index bfed5f0..ceba3b9 100644 --- a/test/fixtures/Identifier/expected-presets-env.js +++ b/test/fixtures/Identifier/expected-presets-env.js @@ -1,108 +1,72 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(falsyStr, "arguments/0"), { - content: "assert(falsyStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(falsyStr)", "test/fixtures/Identifier/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"falsyStr\",\"range\":[7,15]}],\"range\":[0,16]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"falsyStr\",\"range\":[7,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(falsyStr, "arguments/0"), { - content: "assert(falsyStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(falsyStr, messageStr)", "test/fixtures/Identifier/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"falsyStr\",\"range\":[7,15]},{\"type\":\"Identifier\",\"name\":\"messageStr\",\"range\":[17,27]}],\"range\":[0,28]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"falsyStr\",\"range\":[7,15]},{\"type\":{\"label\":\",\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"messageStr\",\"range\":[17,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]}]", visitorKeys: _powerAssertVisitorKeys -}), messageStr); -assert.equal(_rec3._expr(_rec3._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 7, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec4._expr(_rec4._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _ag3 = new _ArgumentRecorder(assert, _am2, 1), + _am3 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec5._expr(_rec5._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 9, +}), + _ag4 = new _ArgumentRecorder(assert.equal, _am3, 0), + _ag5 = new _ArgumentRecorder(assert.equal, _am3, 1), + _am4 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec6._expr(_rec6._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 9, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec7._expr(_rec7._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 14, +}), + _ag6 = new _ArgumentRecorder(assert.equal, _am4, 0), + _ag7 = new _ArgumentRecorder(assert.equal, _am4, 1), + _am5 = _pwmeta(2, "assert.equal(str, anotherStr, messageStr)", "test/fixtures/Identifier/fixture.js", 14, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]},{\"type\":\"Identifier\",\"name\":\"messageStr\",\"range\":[30,40]}],\"range\":[0,41]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\",\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"messageStr\",\"range\":[30,40]},{\"type\":{\"label\":\")\"},\"range\":[40,41]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec8._expr(_rec8._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 14, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]},{\"type\":\"Identifier\",\"name\":\"messageStr\",\"range\":[30,40]}],\"range\":[0,41]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\",\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"messageStr\",\"range\":[30,40]},{\"type\":{\"label\":\")\"},\"range\":[40,41]}]", - visitorKeys: _powerAssertVisitorKeys -}), messageStr); -assert.equal(_rec9._expr(_rec9._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 16, +}), + _ag8 = new _ArgumentRecorder(assert.equal, _am5, 0), + _ag9 = new _ArgumentRecorder(assert.equal, _am5, 1), + _ag10 = new _ArgumentRecorder(assert.equal, _am5, 2), + _am6 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 16, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec10._expr(_rec10._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 16, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"anotherStr\",\"range\":[18,28]}],\"range\":[0,29]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"anotherStr\",\"range\":[18,28]},{\"type\":{\"label\":\")\"},\"range\":[28,29]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec11._expr(_rec11._capt(str, "arguments/0"), { - content: "assert.equal(str, yetAnotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 21, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"yetAnotherStr\",\"range\":[18,31]}],\"range\":[0,32]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"yetAnotherStr\",\"range\":[18,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec12._expr(_rec12._capt(yetAnotherStr, "arguments/1"), { - content: "assert.equal(str, yetAnotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 21, +}), + _ag11 = new _ArgumentRecorder(assert.equal, _am6, 0), + _ag12 = new _ArgumentRecorder(assert.equal, _am6, 1), + _am7 = _pwmeta(2, "assert.equal(str, yetAnotherStr)", "test/fixtures/Identifier/fixture.js", 21, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"yetAnotherStr\",\"range\":[18,31]}],\"range\":[0,32]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"yetAnotherStr\",\"range\":[18,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag13 = new _ArgumentRecorder(assert.equal, _am7, 0), + _ag14 = new _ArgumentRecorder(assert.equal, _am7, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(falsyStr, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(falsyStr, "arguments/0"), new _AssertionMessage(_am2, 1, _ag3._rec(messageStr, "arguments/1"))); +assert.equal(_ag4._rec(str, "arguments/0"), _ag5._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am3, -1)); +assert.equal(_ag6._rec(str, "arguments/0"), _ag7._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am4, -1)); +assert.equal(_ag8._rec(str, "arguments/0"), _ag9._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am5, 2, _ag10._rec(messageStr, "arguments/2"))); +assert.equal(_ag11._rec(str, "arguments/0"), _ag12._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am6, -1)); +assert.equal(_ag13._rec(str, "arguments/0"), _ag14._rec(yetAnotherStr, "arguments/1"), new _AssertionMessage(_am7, -1)); diff --git a/test/fixtures/Identifier/expected.js b/test/fixtures/Identifier/expected.js index 68228b3..3396f0c 100644 --- a/test/fixtures/Identifier/expected.js +++ b/test/fixtures/Identifier/expected.js @@ -1,71 +1,35 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(falsyStr)", "test/fixtures/Identifier/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(falsyStr, messageStr)", "test/fixtures/Identifier/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _ag3 = new _ArgumentRecorder(assert, _am2, 1), + _am3 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 7), + _ag4 = new _ArgumentRecorder(assert.equal, _am3, 0), + _ag5 = new _ArgumentRecorder(assert.equal, _am3, 1), + _am4 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 9), + _ag6 = new _ArgumentRecorder(assert.equal, _am4, 0), + _ag7 = new _ArgumentRecorder(assert.equal, _am4, 1), + _am5 = _pwmeta(2, "assert.equal(str, anotherStr, messageStr)", "test/fixtures/Identifier/fixture.js", 14), + _ag8 = new _ArgumentRecorder(assert.equal, _am5, 0), + _ag9 = new _ArgumentRecorder(assert.equal, _am5, 1), + _ag10 = new _ArgumentRecorder(assert.equal, _am5, 2), + _am6 = _pwmeta(2, "assert.equal(str, anotherStr)", "test/fixtures/Identifier/fixture.js", 16), + _ag11 = new _ArgumentRecorder(assert.equal, _am6, 0), + _ag12 = new _ArgumentRecorder(assert.equal, _am6, 1), + _am7 = _pwmeta(2, "assert.equal(str, yetAnotherStr)", "test/fixtures/Identifier/fixture.js", 21), + _ag13 = new _ArgumentRecorder(assert.equal, _am7, 0), + _ag14 = new _ArgumentRecorder(assert.equal, _am7, 1); -assert(_rec._expr(_rec._capt(falsyStr, "arguments/0"), { - content: "assert(falsyStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(falsyStr, "arguments/0"), { - content: "assert(falsyStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 5 -}), messageStr); -assert.equal(_rec3._expr(_rec3._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 7 -}), _rec4._expr(_rec4._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 7 -})); -assert.equal(_rec5._expr(_rec5._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 9 -}), _rec6._expr(_rec6._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 9 -})); -assert.equal(_rec7._expr(_rec7._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 14 -}), _rec8._expr(_rec8._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr, messageStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 14 -}), messageStr); -assert.equal(_rec9._expr(_rec9._capt(str, "arguments/0"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 16 -}), _rec10._expr(_rec10._capt(anotherStr, "arguments/1"), { - content: "assert.equal(str, anotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 16 -})); -assert.equal(_rec11._expr(_rec11._capt(str, "arguments/0"), { - content: "assert.equal(str, yetAnotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 21 -}), _rec12._expr(_rec12._capt(yetAnotherStr, "arguments/1"), { - content: "assert.equal(str, yetAnotherStr)", - filepath: "test/fixtures/Identifier/fixture.js", - line: 21 -})); +assert(_ag._rec(falsyStr, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(falsyStr, "arguments/0"), new _AssertionMessage(_am2, 1, _ag3._rec(messageStr, "arguments/1"))); +assert.equal(_ag4._rec(str, "arguments/0"), _ag5._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am3, -1)); +assert.equal(_ag6._rec(str, "arguments/0"), _ag7._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am4, -1)); +assert.equal(_ag8._rec(str, "arguments/0"), _ag9._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am5, 2, _ag10._rec(messageStr, "arguments/2"))); +assert.equal(_ag11._rec(str, "arguments/0"), _ag12._rec(anotherStr, "arguments/1"), new _AssertionMessage(_am6, -1)); +assert.equal(_ag13._rec(str, "arguments/0"), _ag14._rec(yetAnotherStr, "arguments/1"), new _AssertionMessage(_am7, -1)); diff --git a/test/fixtures/Literal/expected-presets-env.js b/test/fixtures/Literal/expected-presets-env.js index 4fec66e..1b269ad 100644 --- a/test/fixtures/Literal/expected-presets-env.js +++ b/test/fixtures/Literal/expected-presets-env.js @@ -1,48 +1,87 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); - -assert(false); -assert(0); -assert.equal(1, 0); -assert(false, 'message'); -assert(false, messageStr); -assert.equal(_rec._expr(_rec._capt(foo, "arguments/0"), { - content: "assert.equal(foo, 'bar', 'msg')", - filepath: "test/fixtures/Literal/fixture.js", - line: 13, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(false)", "test/fixtures/Literal/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BooleanLiteral\",\"value\":false,\"range\":[7,12]}],\"range\":[0,13]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"false\"},\"value\":\"false\",\"range\":[7,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am2 = _pwmeta(0, "assert(0)", "test/fixtures/Literal/fixture.js", 5, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"NumericLiteral\",\"value\":0,\"range\":[7,8]}],\"range\":[0,9]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":0,\"range\":[7,8]},{\"type\":{\"label\":\")\"},\"range\":[8,9]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am3 = _pwmeta(2, "assert.equal(1, 0)", "test/fixtures/Literal/fixture.js", 7, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[13,14]},{\"type\":\"NumericLiteral\",\"value\":0,\"range\":[16,17]}],\"range\":[0,18]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[13,14]},{\"type\":{\"label\":\",\"},\"range\":[14,15]},{\"type\":{\"label\":\"num\"},\"value\":0,\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am4 = _pwmeta(0, "assert(false, 'message')", "test/fixtures/Literal/fixture.js", 9, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BooleanLiteral\",\"value\":false,\"range\":[7,12]},{\"type\":\"StringLiteral\",\"value\":\"message\",\"range\":[14,23]}],\"range\":[0,24]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"false\"},\"value\":\"false\",\"range\":[7,12]},{\"type\":{\"label\":\",\"},\"range\":[12,13]},{\"type\":{\"label\":\"string\"},\"value\":\"message\",\"range\":[14,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _am5 = _pwmeta(0, "assert(false, messageStr)", "test/fixtures/Literal/fixture.js", 11, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BooleanLiteral\",\"value\":false,\"range\":[7,12]},{\"type\":\"Identifier\",\"name\":\"messageStr\",\"range\":[14,24]}],\"range\":[0,25]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"false\"},\"value\":\"false\",\"range\":[7,12]},{\"type\":{\"label\":\",\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"messageStr\",\"range\":[14,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am5, 1), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am6 = _pwmeta(2, "assert.equal(foo, 'bar', 'msg')", "test/fixtures/Literal/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[13,16]},{\"type\":\"StringLiteral\",\"value\":\"bar\",\"range\":[18,23]},{\"type\":\"StringLiteral\",\"value\":\"msg\",\"range\":[25,30]}],\"range\":[0,31]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[13,16]},{\"type\":{\"label\":\",\"},\"range\":[16,17]},{\"type\":{\"label\":\"string\"},\"value\":\"bar\",\"range\":[18,23]},{\"type\":{\"label\":\",\"},\"range\":[23,24]},{\"type\":{\"label\":\"string\"},\"value\":\"msg\",\"range\":[25,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]}]", visitorKeys: _powerAssertVisitorKeys -}), 'bar', 'msg'); -assert(_rec2._expr(_rec2._capt(/^not/.exec(_rec2._capt(str, "arguments/0/arguments/0")), "arguments/0"), { - content: "assert(/^not/.exec(str))", - filepath: "test/fixtures/Literal/fixture.js", - line: 15, +}), + _ag2 = new _ArgumentRecorder(assert.equal, _am6, 0), + _am7 = _pwmeta(0, "assert(/^not/.exec(str))", "test/fixtures/Literal/fixture.js", 15, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"RegExpLiteral\",\"pattern\":\"^not\",\"flags\":\"\",\"range\":[7,13]},\"property\":{\"type\":\"Identifier\",\"name\":\"exec\",\"range\":[14,18]},\"computed\":false,\"range\":[7,18]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"str\",\"range\":[19,22]}],\"range\":[7,23]}],\"range\":[0,24]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"regexp\"},\"value\":{\"pattern\":\"^not\",\"flags\":\"\"},\"range\":[7,13]},{\"type\":{\"label\":\".\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"exec\",\"range\":[14,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"str\",\"range\":[19,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(fuga, "arguments/0/left") !== 'ふが', "arguments/0"), { - content: "assert(fuga !== '\u3075\u304C')", - filepath: "test/fixtures/Literal/fixture.js", - line: 17, +}), + _ag3 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(fuga !== '\u3075\u304C')", "test/fixtures/Literal/fixture.js", 17, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[7,11]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u3075\u304C\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"string\"},\"value\":\"\u3075\u304C\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"string\"},\"value\":\"\u3075\u304C\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt('ほげ' !== 'ふが', "arguments/0"), { - content: "assert('\u307B\u3052' !== '\u3075\u304C')", - filepath: "test/fixtures/Literal/fixture.js", - line: 19, +}), + _ag4 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert('\u307B\u3052' !== '\u3075\u304C')", "test/fixtures/Literal/fixture.js", 19, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"StringLiteral\",\"value\":\"\u307B\u3052\",\"range\":[7,11]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u3075\u304C\",\"range\":[16,20]},\"range\":[7,20]}],\"range\":[0,21]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"string\"},\"value\":\"\u307B\u3052\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"string\"},\"value\":\"\u3075\u304C\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"string\"},\"value\":\"\u307B\u3052\",\"range\":[7,11]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[12,15]},{\"type\":{\"label\":\"string\"},\"value\":\"\u3075\u304C\",\"range\":[16,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ag5 = new _ArgumentRecorder(assert, _am9, 0), + _am10 = _pwmeta(0, "assert(0b111110111)", "test/fixtures/Literal/fixture.js", 21, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"NumericLiteral\",\"value\":503,\"range\":[7,18]}],\"range\":[0,19]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":503,\"range\":[7,18]},{\"type\":{\"label\":\")\"},\"range\":[18,19]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _am11 = _pwmeta(0, "assert(0o767)", "test/fixtures/Literal/fixture.js", 23, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"NumericLiteral\",\"value\":503,\"range\":[7,12]}],\"range\":[0,13]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":503,\"range\":[7,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]}]", + visitorKeys: _powerAssertVisitorKeys +}); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(false); +assert(0); +assert.equal(1, 0); +assert(false, 'message'); +assert(false, new _AssertionMessage(_am5, 1, _ag._rec(messageStr, "arguments/1"))); +assert.equal(_ag2._rec(foo, "arguments/0"), 'bar', new _AssertionMessage(_am6, 2, 'msg')); +assert(_ag3._rec(/^not/.exec(_ag3._tap(str, "arguments/0/arguments/0")), "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag4._rec(_ag4._tap(fuga, "arguments/0/left") !== 'ふが', "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag5._rec('ほげ' !== 'ふが', "arguments/0"), new _AssertionMessage(_am9, -1)); assert(503); assert(503); diff --git a/test/fixtures/Literal/expected.js b/test/fixtures/Literal/expected.js index afbfb90..92de650 100644 --- a/test/fixtures/Literal/expected.js +++ b/test/fixtures/Literal/expected.js @@ -1,35 +1,34 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(false)", "test/fixtures/Literal/fixture.js", 3), + _am2 = _pwmeta(0, "assert(0)", "test/fixtures/Literal/fixture.js", 5), + _am3 = _pwmeta(2, "assert.equal(1, 0)", "test/fixtures/Literal/fixture.js", 7), + _am4 = _pwmeta(0, "assert(false, 'message')", "test/fixtures/Literal/fixture.js", 9), + _am5 = _pwmeta(0, "assert(false, messageStr)", "test/fixtures/Literal/fixture.js", 11), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am5, 1), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am6 = _pwmeta(2, "assert.equal(foo, 'bar', 'msg')", "test/fixtures/Literal/fixture.js", 13), + _ag2 = new _ArgumentRecorder(assert.equal, _am6, 0), + _am7 = _pwmeta(0, "assert(/^not/.exec(str))", "test/fixtures/Literal/fixture.js", 15), + _ag3 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(fuga !== '\u3075\u304C')", "test/fixtures/Literal/fixture.js", 17), + _ag4 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(0, "assert('\u307B\u3052' !== '\u3075\u304C')", "test/fixtures/Literal/fixture.js", 19), + _ag5 = new _ArgumentRecorder(assert, _am9, 0), + _am10 = _pwmeta(0, "assert(0b111110111)", "test/fixtures/Literal/fixture.js", 21), + _am11 = _pwmeta(0, "assert(0o767)", "test/fixtures/Literal/fixture.js", 23); assert(false); assert(0); assert.equal(1, 0); assert(false, 'message'); -assert(false, messageStr); -assert.equal(_rec._expr(_rec._capt(foo, "arguments/0"), { - content: "assert.equal(foo, 'bar', 'msg')", - filepath: "test/fixtures/Literal/fixture.js", - line: 13 -}), 'bar', 'msg'); -assert(_rec2._expr(_rec2._capt(/^not/.exec(_rec2._capt(str, "arguments/0/arguments/0")), "arguments/0"), { - content: "assert(/^not/.exec(str))", - filepath: "test/fixtures/Literal/fixture.js", - line: 15 -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(fuga, "arguments/0/left") !== 'ふが', "arguments/0"), { - content: "assert(fuga !== '\u3075\u304C')", - filepath: "test/fixtures/Literal/fixture.js", - line: 17 -})); -assert(_rec4._expr(_rec4._capt('ほげ' !== 'ふが', "arguments/0"), { - content: "assert('\u307B\u3052' !== '\u3075\u304C')", - filepath: "test/fixtures/Literal/fixture.js", - line: 19 -})); +assert(false, new _AssertionMessage(_am5, 1, _ag._rec(messageStr, "arguments/1"))); +assert.equal(_ag2._rec(foo, "arguments/0"), 'bar', new _AssertionMessage(_am6, 2, 'msg')); +assert(_ag3._rec(/^not/.exec(_ag3._tap(str, "arguments/0/arguments/0")), "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag4._rec(_ag4._tap(fuga, "arguments/0/left") !== 'ふが', "arguments/0"), new _AssertionMessage(_am8, -1)); +assert(_ag5._rec('ほげ' !== 'ふが', "arguments/0"), new _AssertionMessage(_am9, -1)); assert(0b111110111); assert(0o767); diff --git a/test/fixtures/LogicalExpression/expected-presets-env.js b/test/fixtures/LogicalExpression/expected-presets-env.js index d4138bd..47cec4b 100644 --- a/test/fixtures/LogicalExpression/expected-presets-env.js +++ b/test/fixtures/LogicalExpression/expected-presets-env.js @@ -1,58 +1,52 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(_rec._capt(5 < _rec._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec._capt(_rec._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(5 < actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(5 < actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"&&\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"NumericLiteral\",\"value\":5,\"range\":[7,8]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[11,17]},\"range\":[7,17]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[21,27]},\"right\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[30,32]},\"range\":[21,32]},\"range\":[7,32]}],\"range\":[0,33]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[7,8]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[7,8]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.ok(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(actual, "arguments/0/left/left") < 5, "arguments/0/left") || _rec2._capt(13 < _rec2._capt(actual, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), { - content: "assert.ok(actual < 5 || 13 < actual)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(1, "assert.ok(actual < 5 || 13 < actual)", "test/fixtures/LogicalExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"ok\",\"range\":[7,9]},\"computed\":false,\"range\":[0,9]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"||\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[10,16]},\"right\":{\"type\":\"NumericLiteral\",\"value\":5,\"range\":[19,20]},\"range\":[10,20]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[24,26]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[29,35]},\"range\":[24,35]},\"range\":[10,35]}],\"range\":[0,36]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[10,16]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[17,18]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[19,20]},{\"type\":{\"label\":\"||\"},\"value\":\"||\",\"range\":[21,23]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[24,26]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[29,35]},{\"type\":{\"label\":\")\"},\"range\":[35,36]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[10,16]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[17,18]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[19,20]},{\"type\":{\"label\":\"||\"},\"value\":\"||\",\"range\":[21,23]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[24,26]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[29,35]},{\"type\":{\"label\":\")\"},\"range\":[35,36]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(2 > _rec3._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec3._capt(_rec3._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(2 > actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert.ok, _am2, 0), + _am3 = _pwmeta(0, "assert(2 > actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"&&\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\">\",\"left\":{\"type\":\"NumericLiteral\",\"value\":2,\"range\":[7,8]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[11,17]},\"range\":[7,17]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[21,27]},\"right\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[30,32]},\"range\":[21,32]},\"range\":[7,32]}],\"range\":[0,33]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":2,\"range\":[7,8]},{\"type\":{\"label\":\"</>\"},\"value\":\">\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":2,\"range\":[7,8]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\">\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(2 > _rec4._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec4._capt(_rec4._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(2 > actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(2 > actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"&&\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\">\",\"left\":{\"type\":\"NumericLiteral\",\"value\":2,\"range\":[7,8]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[11,17]},\"range\":[7,17]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[21,27]},\"right\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[30,32]},\"range\":[21,32]},\"range\":[7,32]}],\"range\":[0,33]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":2,\"range\":[7,8]},{\"type\":{\"label\":\"</>\"},\"value\":\">\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec5._expr(_rec5._capt(_rec5._capt(5 < _rec5._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec5._capt(_rec5._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert.equal(5 < actual && actual < 13, falsy)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 11, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"&&\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"NumericLiteral\",\"value\":5,\"range\":[13,14]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[17,23]},\"range\":[13,23]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[27,33]},\"right\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[36,38]},\"range\":[27,38]},\"range\":[13,38]},{\"type\":\"Identifier\",\"name\":\"falsy\",\"range\":[40,45]}],\"range\":[0,46]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[13,14]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[17,23]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[24,26]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[27,33]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[34,35]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[36,38]},{\"type\":{\"label\":\",\"},\"range\":[38,39]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[40,45]},{\"type\":{\"label\":\")\"},\"range\":[45,46]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"num\"},\"value\":2,\"range\":[7,8]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\">\",\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[11,17]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[21,27]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[28,29]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[30,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec6._expr(_rec6._capt(falsy, "arguments/1"), { - content: "assert.equal(5 < actual && actual < 13, falsy)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(2, "assert.equal(5 < actual && actual < 13, falsy)", "test/fixtures/LogicalExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"LogicalExpression\",\"operator\":\"&&\",\"left\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"NumericLiteral\",\"value\":5,\"range\":[13,14]},\"right\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[17,23]},\"range\":[13,23]},\"right\":{\"type\":\"BinaryExpression\",\"operator\":\"<\",\"left\":{\"type\":\"Identifier\",\"name\":\"actual\",\"range\":[27,33]},\"right\":{\"type\":\"NumericLiteral\",\"value\":13,\"range\":[36,38]},\"range\":[27,38]},\"range\":[13,38]},{\"type\":\"Identifier\",\"name\":\"falsy\",\"range\":[40,45]}],\"range\":[0,46]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[13,14]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[17,23]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[24,26]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[27,33]},{\"type\":{\"label\":\"</>\"},\"value\":\"<\",\"range\":[34,35]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[36,38]},{\"type\":{\"label\":\",\"},\"range\":[38,39]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[40,45]},{\"type\":{\"label\":\")\"},\"range\":[45,46]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"num\"},\"value\":5,\"range\":[13,14]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[17,23]},{\"type\":{\"label\":\"&&\"},\"value\":\"&&\",\"range\":[24,26]},{\"type\":{\"label\":\"name\"},\"value\":\"actual\",\"range\":[27,33]},{\"type\":{\"label\":\"</>/<=/>=\"},\"value\":\"<\",\"range\":[34,35]},{\"type\":{\"label\":\"num\"},\"value\":13,\"range\":[36,38]},{\"type\":{\"label\":\",\"},\"range\":[38,39]},{\"type\":{\"label\":\"name\"},\"value\":\"falsy\",\"range\":[40,45]},{\"type\":{\"label\":\")\"},\"range\":[45,46]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag5 = new _ArgumentRecorder(assert.equal, _am5, 0), + _ag6 = new _ArgumentRecorder(assert.equal, _am5, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(_ag._tap(5 < _ag._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag._tap(_ag._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); +assert.ok(_ag2._rec(_ag2._tap(_ag2._tap(actual, "arguments/0/left/left") < 5, "arguments/0/left") || _ag2._tap(13 < _ag2._tap(actual, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(2 > _ag3._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag3._tap(_ag3._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(2 > _ag4._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag4._tap(_ag4._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert.equal(_ag5._rec(_ag5._tap(5 < _ag5._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag5._tap(_ag5._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), _ag6._rec(falsy, "arguments/1"), new _AssertionMessage(_am5, -1)); diff --git a/test/fixtures/LogicalExpression/expected.js b/test/fixtures/LogicalExpression/expected.js index 3c69341..3bda652 100644 --- a/test/fixtures/LogicalExpression/expected.js +++ b/test/fixtures/LogicalExpression/expected.js @@ -1,39 +1,23 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(5 < actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(1, "assert.ok(actual < 5 || 13 < actual)", "test/fixtures/LogicalExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert.ok, _am2, 0), + _am3 = _pwmeta(0, "assert(2 > actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(2 > actual && actual < 13)", "test/fixtures/LogicalExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(2, "assert.equal(5 < actual && actual < 13, falsy)", "test/fixtures/LogicalExpression/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert.equal, _am5, 0), + _ag6 = new _ArgumentRecorder(assert.equal, _am5, 1); -assert(_rec._expr(_rec._capt(_rec._capt(5 < _rec._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec._capt(_rec._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(5 < actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 3 -})); -assert.ok(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(actual, "arguments/0/left/left") < 5, "arguments/0/left") || _rec2._capt(13 < _rec2._capt(actual, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), { - content: "assert.ok(actual < 5 || 13 < actual)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(2 > _rec3._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec3._capt(_rec3._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(2 > actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(2 > _rec4._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec4._capt(_rec4._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert(2 > actual && actual < 13)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 9 -})); -assert.equal(_rec5._expr(_rec5._capt(_rec5._capt(5 < _rec5._capt(actual, "arguments/0/left/right"), "arguments/0/left") && _rec5._capt(_rec5._capt(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), { - content: "assert.equal(5 < actual && actual < 13, falsy)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 11 -}), _rec6._expr(_rec6._capt(falsy, "arguments/1"), { - content: "assert.equal(5 < actual && actual < 13, falsy)", - filepath: "test/fixtures/LogicalExpression/fixture.js", - line: 11 -})); +assert(_ag._rec(_ag._tap(5 < _ag._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag._tap(_ag._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); +assert.ok(_ag2._rec(_ag2._tap(_ag2._tap(actual, "arguments/0/left/left") < 5, "arguments/0/left") || _ag2._tap(13 < _ag2._tap(actual, "arguments/0/right/right"), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(2 > _ag3._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag3._tap(_ag3._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(2 > _ag4._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag4._tap(_ag4._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert.equal(_ag5._rec(_ag5._tap(5 < _ag5._tap(actual, "arguments/0/left/right"), "arguments/0/left") && _ag5._tap(_ag5._tap(actual, "arguments/0/right/left") < 13, "arguments/0/right"), "arguments/0"), _ag6._rec(falsy, "arguments/1"), new _AssertionMessage(_am5, -1)); diff --git a/test/fixtures/MemberExpression/expected-presets-env.js b/test/fixtures/MemberExpression/expected-presets-env.js index 3888260..9058bfa 100644 --- a/test/fixtures/MemberExpression/expected-presets-env.js +++ b/test/fixtures/MemberExpression/expected-presets-env.js @@ -1,111 +1,88 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(_rec._capt(foo, "arguments/0/object").bar, "arguments/0"), { - content: "assert(foo.bar)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(foo.bar)", "test/fixtures/MemberExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[11,14]},\"computed\":false,\"range\":[7,14]}],\"range\":[0,15]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[11,14]},{\"type\":{\"label\":\")\"},\"range\":[14,15]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(foo, "arguments/0/object/object").bar, "arguments/0/object").baz, "arguments/0"), { - content: "assert(foo.bar.baz)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(foo.bar.baz)", "test/fixtures/MemberExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[11,14]},\"computed\":false,\"range\":[7,14]},\"property\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[15,18]},\"computed\":false,\"range\":[7,18]}],\"range\":[0,19]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[11,14]},{\"type\":{\"label\":\".\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[15,18]},{\"type\":{\"label\":\")\"},\"range\":[18,19]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(foo, "arguments/0/object")['bar'], "arguments/0"), { - content: "assert(foo['bar'])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(foo['bar'])", "test/fixtures/MemberExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"StringLiteral\",\"value\":\"bar\",\"range\":[11,16]},\"computed\":true,\"range\":[7,17]}],\"range\":[0,18]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"string\"},\"value\":\"bar\",\"range\":[11,16]},{\"type\":{\"label\":\"]\"},\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(foo, "arguments/0/object")[_rec4._capt(propName, "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(foo[propName])", "test/fixtures/MemberExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[11,19]},\"computed\":true,\"range\":[7,20]}],\"range\":[0,21]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[11,19]},{\"type\":{\"label\":\"]\"},\"range\":[19,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(foo, "arguments/0/object")[_rec5._capt(propName, "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(foo[propName])", "test/fixtures/MemberExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[11,19]},\"computed\":true,\"range\":[7,20]}],\"range\":[0,21]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[11,19]},{\"type\":{\"label\":\"]\"},\"range\":[19,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(foo, "arguments/0/object")[_rec6._capt(func(_rec6._capt(key, "arguments/0/property/arguments/0")), "arguments/0/property")], "arguments/0"), { - content: "assert(foo[func(key)])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 13, +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(foo[func(key)])", "test/fixtures/MemberExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"func\",\"range\":[11,15]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"key\",\"range\":[16,19]}],\"range\":[11,20]},\"computed\":true,\"range\":[7,21]}],\"range\":[0,22]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"func\",\"range\":[11,15]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"key\",\"range\":[16,19]},{\"type\":{\"label\":\")\"},\"range\":[19,20]},{\"type\":{\"label\":\"]\"},\"range\":[20,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec7._expr(_rec7._capt(_rec7._capt(_rec7._capt(_rec7._capt(foo, "arguments/0/object/object/object")[_rec7._capt(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_rec7._capt(_rec7._capt(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName]['key'][keys()['name']])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 15, +}), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(0, "assert(foo[propName]['key'][keys()['name']])", "test/fixtures/MemberExpression/fixture.js", 15, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[11,19]},\"computed\":true,\"range\":[7,20]},\"property\":{\"type\":\"StringLiteral\",\"value\":\"key\",\"range\":[21,26]},\"computed\":true,\"range\":[7,27]},\"property\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"keys\",\"range\":[28,32]},\"arguments\":[],\"range\":[28,34]},\"property\":{\"type\":\"StringLiteral\",\"value\":\"name\",\"range\":[35,41]},\"computed\":true,\"range\":[28,42]},\"computed\":true,\"range\":[7,43]}],\"range\":[0,44]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[11,19]},{\"type\":{\"label\":\"]\"},\"range\":[19,20]},{\"type\":{\"label\":\"[\"},\"range\":[20,21]},{\"type\":{\"label\":\"string\"},\"value\":\"key\",\"range\":[21,26]},{\"type\":{\"label\":\"]\"},\"range\":[26,27]},{\"type\":{\"label\":\"[\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"keys\",\"range\":[28,32]},{\"type\":{\"label\":\"(\"},\"range\":[32,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"[\"},\"range\":[34,35]},{\"type\":{\"label\":\"string\"},\"value\":\"name\",\"range\":[35,41]},{\"type\":{\"label\":\"]\"},\"range\":[41,42]},{\"type\":{\"label\":\"]\"},\"range\":[42,43]},{\"type\":{\"label\":\")\"},\"range\":[43,44]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt(foo, "arguments/0/object/object/object")[_rec8._capt(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_rec8._capt(_rec8._capt(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName]['key'][keys()['name']])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 17, +}), + _ag7 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(foo[propName]['key'][keys()['name']])", "test/fixtures/MemberExpression/fixture.js", 17, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[11,19]},\"computed\":true,\"range\":[7,20]},\"property\":{\"type\":\"StringLiteral\",\"value\":\"key\",\"range\":[21,26]},\"computed\":true,\"range\":[7,27]},\"property\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"keys\",\"range\":[28,32]},\"arguments\":[],\"range\":[28,34]},\"property\":{\"type\":\"StringLiteral\",\"value\":\"name\",\"range\":[35,41]},\"computed\":true,\"range\":[28,42]},\"computed\":true,\"range\":[7,43]}],\"range\":[0,44]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[7,10]},{\"type\":{\"label\":\"[\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[11,19]},{\"type\":{\"label\":\"]\"},\"range\":[19,20]},{\"type\":{\"label\":\"[\"},\"range\":[20,21]},{\"type\":{\"label\":\"string\"},\"value\":\"key\",\"range\":[21,26]},{\"type\":{\"label\":\"]\"},\"range\":[26,27]},{\"type\":{\"label\":\"[\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"keys\",\"range\":[28,32]},{\"type\":{\"label\":\"(\"},\"range\":[32,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"[\"},\"range\":[34,35]},{\"type\":{\"label\":\"string\"},\"value\":\"name\",\"range\":[35,41]},{\"type\":{\"label\":\"]\"},\"range\":[41,42]},{\"type\":{\"label\":\"]\"},\"range\":[42,43]},{\"type\":{\"label\":\")\"},\"range\":[43,44]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.equal(_rec9._expr(_rec9._capt(_rec9._capt(ary1, "arguments/0/object").length, "arguments/0"), { - content: "assert.equal(ary1.length, ary2.length)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 19, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary1\",\"range\":[13,17]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[18,24]},\"computed\":false,\"range\":[13,24]},{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary2\",\"range\":[26,30]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[31,37]},\"computed\":false,\"range\":[26,37]}],\"range\":[0,38]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"ary1\",\"range\":[13,17]},{\"type\":{\"label\":\".\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[18,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"ary2\",\"range\":[26,30]},{\"type\":{\"label\":\".\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[31,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec10._expr(_rec10._capt(_rec10._capt(ary2, "arguments/1/object").length, "arguments/1"), { - content: "assert.equal(ary1.length, ary2.length)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 19, +}), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(2, "assert.equal(ary1.length, ary2.length)", "test/fixtures/MemberExpression/fixture.js", 19, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"equal\",\"range\":[7,12]},\"computed\":false,\"range\":[0,12]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary1\",\"range\":[13,17]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[18,24]},\"computed\":false,\"range\":[13,24]},{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"ary2\",\"range\":[26,30]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[31,37]},\"computed\":false,\"range\":[26,37]}],\"range\":[0,38]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"equal\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"ary1\",\"range\":[13,17]},{\"type\":{\"label\":\".\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[18,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"ary2\",\"range\":[26,30]},{\"type\":{\"label\":\".\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[31,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.deepEqual(_rec11._expr(_rec11._capt(_rec11._capt(foo, "arguments/0/object").propName, "arguments/0"), { - content: "assert.deepEqual(foo.propName, foo[key])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 21, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"deepEqual\",\"range\":[7,16]},\"computed\":false,\"range\":[0,16]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[17,20]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[21,29]},\"computed\":false,\"range\":[17,29]},{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[31,34]},\"property\":{\"type\":\"Identifier\",\"name\":\"key\",\"range\":[35,38]},\"computed\":true,\"range\":[31,39]}],\"range\":[0,40]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"deepEqual\",\"range\":[7,16]},{\"type\":{\"label\":\"(\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[17,20]},{\"type\":{\"label\":\".\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[21,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[31,34]},{\"type\":{\"label\":\"[\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"key\",\"range\":[35,38]},{\"type\":{\"label\":\"]\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec12._expr(_rec12._capt(_rec12._capt(foo, "arguments/1/object")[_rec12._capt(key, "arguments/1/property")], "arguments/1"), { - content: "assert.deepEqual(foo.propName, foo[key])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 21, +}), + _ag9 = new _ArgumentRecorder(assert.equal, _am9, 0), + _ag10 = new _ArgumentRecorder(assert.equal, _am9, 1), + _am10 = _pwmeta(6, "assert.deepEqual(foo.propName, foo[key])", "test/fixtures/MemberExpression/fixture.js", 21, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"deepEqual\",\"range\":[7,16]},\"computed\":false,\"range\":[0,16]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[17,20]},\"property\":{\"type\":\"Identifier\",\"name\":\"propName\",\"range\":[21,29]},\"computed\":false,\"range\":[17,29]},{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[31,34]},\"property\":{\"type\":\"Identifier\",\"name\":\"key\",\"range\":[35,38]},\"computed\":true,\"range\":[31,39]}],\"range\":[0,40]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"deepEqual\",\"range\":[7,16]},{\"type\":{\"label\":\"(\"},\"range\":[16,17]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[17,20]},{\"type\":{\"label\":\".\"},\"range\":[20,21]},{\"type\":{\"label\":\"name\"},\"value\":\"propName\",\"range\":[21,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[31,34]},{\"type\":{\"label\":\"[\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"key\",\"range\":[35,38]},{\"type\":{\"label\":\"]\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag11 = new _ArgumentRecorder(assert.deepEqual, _am10, 0), + _ag12 = new _ArgumentRecorder(assert.deepEqual, _am10, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(_ag._tap(foo, "arguments/0/object").bar, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(_ag2._tap(foo, "arguments/0/object/object").bar, "arguments/0/object").baz, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(foo, "arguments/0/object")['bar'], "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(foo, "arguments/0/object")[_ag4._tap(propName, "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(foo, "arguments/0/object")[_ag5._tap(propName, "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(foo, "arguments/0/object")[_ag6._tap(func(_ag6._tap(key, "arguments/0/property/arguments/0")), "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am6, -1)); +assert(_ag7._rec(_ag7._tap(_ag7._tap(_ag7._tap(foo, "arguments/0/object/object/object")[_ag7._tap(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_ag7._tap(_ag7._tap(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag8._rec(_ag8._tap(_ag8._tap(_ag8._tap(foo, "arguments/0/object/object/object")[_ag8._tap(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_ag8._tap(_ag8._tap(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am8, -1)); +assert.equal(_ag9._rec(_ag9._tap(ary1, "arguments/0/object").length, "arguments/0"), _ag10._rec(_ag10._tap(ary2, "arguments/1/object").length, "arguments/1"), new _AssertionMessage(_am9, -1)); +assert.deepEqual(_ag11._rec(_ag11._tap(foo, "arguments/0/object").propName, "arguments/0"), _ag12._rec(_ag12._tap(foo, "arguments/1/object")[_ag12._tap(key, "arguments/1/property")], "arguments/1"), new _AssertionMessage(_am10, -1)); diff --git a/test/fixtures/MemberExpression/expected.js b/test/fixtures/MemberExpression/expected.js index 575ab70..7107a49 100644 --- a/test/fixtures/MemberExpression/expected.js +++ b/test/fixtures/MemberExpression/expected.js @@ -1,74 +1,39 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(foo.bar)", "test/fixtures/MemberExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(foo.bar.baz)", "test/fixtures/MemberExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(foo['bar'])", "test/fixtures/MemberExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(foo[propName])", "test/fixtures/MemberExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(foo[propName])", "test/fixtures/MemberExpression/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(foo[func(key)])", "test/fixtures/MemberExpression/fixture.js", 13), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(0, "assert(foo[propName]['key'][keys()['name']])", "test/fixtures/MemberExpression/fixture.js", 15), + _ag7 = new _ArgumentRecorder(assert, _am7, 0), + _am8 = _pwmeta(0, "assert(foo[propName]['key'][keys()['name']])", "test/fixtures/MemberExpression/fixture.js", 17), + _ag8 = new _ArgumentRecorder(assert, _am8, 0), + _am9 = _pwmeta(2, "assert.equal(ary1.length, ary2.length)", "test/fixtures/MemberExpression/fixture.js", 19), + _ag9 = new _ArgumentRecorder(assert.equal, _am9, 0), + _ag10 = new _ArgumentRecorder(assert.equal, _am9, 1), + _am10 = _pwmeta(6, "assert.deepEqual(foo.propName, foo[key])", "test/fixtures/MemberExpression/fixture.js", 21), + _ag11 = new _ArgumentRecorder(assert.deepEqual, _am10, 0), + _ag12 = new _ArgumentRecorder(assert.deepEqual, _am10, 1); -assert(_rec._expr(_rec._capt(_rec._capt(foo, "arguments/0/object").bar, "arguments/0"), { - content: "assert(foo.bar)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(foo, "arguments/0/object/object").bar, "arguments/0/object").baz, "arguments/0"), { - content: "assert(foo.bar.baz)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(_rec3._capt(foo, "arguments/0/object")['bar'], "arguments/0"), { - content: "assert(foo['bar'])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt(_rec4._capt(foo, "arguments/0/object")[_rec4._capt(propName, "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 9 -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(foo, "arguments/0/object")[_rec5._capt(propName, "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 11 -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(foo, "arguments/0/object")[_rec6._capt(func(_rec6._capt(key, "arguments/0/property/arguments/0")), "arguments/0/property")], "arguments/0"), { - content: "assert(foo[func(key)])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 13 -})); -assert(_rec7._expr(_rec7._capt(_rec7._capt(_rec7._capt(_rec7._capt(foo, "arguments/0/object/object/object")[_rec7._capt(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_rec7._capt(_rec7._capt(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName]['key'][keys()['name']])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 15 -})); -assert(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt(foo, "arguments/0/object/object/object")[_rec8._capt(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_rec8._capt(_rec8._capt(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), { - content: "assert(foo[propName]['key'][keys()['name']])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 17 -})); -assert.equal(_rec9._expr(_rec9._capt(_rec9._capt(ary1, "arguments/0/object").length, "arguments/0"), { - content: "assert.equal(ary1.length, ary2.length)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 19 -}), _rec10._expr(_rec10._capt(_rec10._capt(ary2, "arguments/1/object").length, "arguments/1"), { - content: "assert.equal(ary1.length, ary2.length)", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 19 -})); -assert.deepEqual(_rec11._expr(_rec11._capt(_rec11._capt(foo, "arguments/0/object").propName, "arguments/0"), { - content: "assert.deepEqual(foo.propName, foo[key])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 21 -}), _rec12._expr(_rec12._capt(_rec12._capt(foo, "arguments/1/object")[_rec12._capt(key, "arguments/1/property")], "arguments/1"), { - content: "assert.deepEqual(foo.propName, foo[key])", - filepath: "test/fixtures/MemberExpression/fixture.js", - line: 21 -})); +assert(_ag._rec(_ag._tap(foo, "arguments/0/object").bar, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap(_ag2._tap(foo, "arguments/0/object/object").bar, "arguments/0/object").baz, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_ag3._tap(foo, "arguments/0/object")['bar'], "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(_ag4._tap(foo, "arguments/0/object")[_ag4._tap(propName, "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(foo, "arguments/0/object")[_ag5._tap(propName, "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(foo, "arguments/0/object")[_ag6._tap(func(_ag6._tap(key, "arguments/0/property/arguments/0")), "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am6, -1)); +assert(_ag7._rec(_ag7._tap(_ag7._tap(_ag7._tap(foo, "arguments/0/object/object/object")[_ag7._tap(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_ag7._tap(_ag7._tap(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am7, -1)); +assert(_ag8._rec(_ag8._tap(_ag8._tap(_ag8._tap(foo, "arguments/0/object/object/object")[_ag8._tap(propName, "arguments/0/object/object/property")], "arguments/0/object/object")['key'], "arguments/0/object")[_ag8._tap(_ag8._tap(keys(), "arguments/0/property/object")['name'], "arguments/0/property")], "arguments/0"), new _AssertionMessage(_am8, -1)); +assert.equal(_ag9._rec(_ag9._tap(ary1, "arguments/0/object").length, "arguments/0"), _ag10._rec(_ag10._tap(ary2, "arguments/1/object").length, "arguments/1"), new _AssertionMessage(_am9, -1)); +assert.deepEqual(_ag11._rec(_ag11._tap(foo, "arguments/0/object").propName, "arguments/0"), _ag12._rec(_ag12._tap(foo, "arguments/1/object")[_ag12._tap(key, "arguments/1/property")], "arguments/1"), new _AssertionMessage(_am10, -1)); diff --git a/test/fixtures/Mocha/expected-presets-env.js b/test/fixtures/Mocha/expected-presets-env.js index c07581e..cf78076 100644 --- a/test/fixtures/Mocha/expected-presets-env.js +++ b/test/fixtures/Mocha/expected-presets-env.js @@ -1,7 +1,18 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var assert = require('power-assert'); @@ -10,31 +21,27 @@ describe('Array#indexOf()', function () { this.ary = [1, 2, 3]; }); it('should return index when the value is present', function () { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert(this.ary.indexOf(who) === two)", "test/fixtures/Mocha/fixture.js", 11, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"ThisExpression\",\"range\":[7,11]},\"property\":{\"type\":\"Identifier\",\"name\":\"ary\",\"range\":[12,15]},\"computed\":false,\"range\":[7,15]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[16,23]},\"computed\":false,\"range\":[7,23]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"who\",\"range\":[24,27]}],\"range\":[7,28]},\"right\":{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[33,36]},\"range\":[7,36]}],\"range\":[0,37]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"this\"},\"value\":\"this\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"ary\",\"range\":[12,15]},{\"type\":{\"label\":\".\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[16,23]},{\"type\":{\"label\":\"(\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"who\",\"range\":[24,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[29,32]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[33,36]},{\"type\":{\"label\":\")\"},\"range\":[36,37]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag = new _ArgumentRecorder(assert, _am, 0); var who = 'ariya', two = 2; - assert(_rec._expr(_rec._capt(_rec._capt(_rec._capt(this.ary, "arguments/0/left/callee/object").indexOf(_rec._capt(who, "arguments/0/left/arguments/0")), "arguments/0/left") === _rec._capt(two, "arguments/0/right"), "arguments/0"), { - content: "assert(this.ary.indexOf(who) === two)", - filepath: "test/fixtures/Mocha/fixture.js", - line: 11, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"ThisExpression\",\"range\":[7,11]},\"property\":{\"type\":\"Identifier\",\"name\":\"ary\",\"range\":[12,15]},\"computed\":false,\"range\":[7,15]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[16,23]},\"computed\":false,\"range\":[7,23]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"who\",\"range\":[24,27]}],\"range\":[7,28]},\"right\":{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[33,36]},\"range\":[7,36]}],\"range\":[0,37]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"this\"},\"value\":\"this\",\"range\":[7,11]},{\"type\":{\"label\":\".\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"ary\",\"range\":[12,15]},{\"type\":{\"label\":\".\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[16,23]},{\"type\":{\"label\":\"(\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"who\",\"range\":[24,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[29,32]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[33,36]},{\"type\":{\"label\":\")\"},\"range\":[36,37]}]", - visitorKeys: _powerAssertVisitorKeys - })); + assert(_ag._rec(_ag._tap(_ag._tap(this.ary, "arguments/0/left/callee/object").indexOf(_ag._tap(who, "arguments/0/left/arguments/0")), "arguments/0/left") === _ag._tap(two, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); }); it('should return -1 when the value is not present', function () { - var _rec2 = new _powerAssertRecorder(); + var _am2 = _pwmeta(1, "assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE')", "test/fixtures/Mocha/fixture.js", 15, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"ok\",\"range\":[7,9]},\"computed\":false,\"range\":[0,9]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"ThisExpression\",\"range\":[10,14]},\"property\":{\"type\":\"Identifier\",\"name\":\"ary\",\"range\":[15,18]},\"computed\":false,\"range\":[10,18]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[19,26]},\"computed\":false,\"range\":[10,26]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[27,30]}],\"range\":[10,31]},\"right\":{\"type\":\"Identifier\",\"name\":\"minusOne\",\"range\":[36,44]},\"range\":[10,44]},{\"type\":\"StringLiteral\",\"value\":\"THIS IS AN ASSERTION MESSAGE\",\"range\":[46,76]}],\"range\":[0,77]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"this\"},\"value\":\"this\",\"range\":[10,14]},{\"type\":{\"label\":\".\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"ary\",\"range\":[15,18]},{\"type\":{\"label\":\".\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[19,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[27,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[32,35]},{\"type\":{\"label\":\"name\"},\"value\":\"minusOne\",\"range\":[36,44]},{\"type\":{\"label\":\",\"},\"range\":[44,45]},{\"type\":{\"label\":\"string\"},\"value\":\"THIS IS AN ASSERTION MESSAGE\",\"range\":[46,76]},{\"type\":{\"label\":\")\"},\"range\":[76,77]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag2 = new _ArgumentRecorder(assert.ok, _am2, 0); var minusOne = -1, two = 2; - assert.ok(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(this.ary, "arguments/0/left/callee/object").indexOf(_rec2._capt(two, "arguments/0/left/arguments/0")), "arguments/0/left") === _rec2._capt(minusOne, "arguments/0/right"), "arguments/0"), { - content: "assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE')", - filepath: "test/fixtures/Mocha/fixture.js", - line: 15, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"ok\",\"range\":[7,9]},\"computed\":false,\"range\":[0,9]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"ThisExpression\",\"range\":[10,14]},\"property\":{\"type\":\"Identifier\",\"name\":\"ary\",\"range\":[15,18]},\"computed\":false,\"range\":[10,18]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[19,26]},\"computed\":false,\"range\":[10,26]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"two\",\"range\":[27,30]}],\"range\":[10,31]},\"right\":{\"type\":\"Identifier\",\"name\":\"minusOne\",\"range\":[36,44]},\"range\":[10,44]},{\"type\":\"StringLiteral\",\"value\":\"THIS IS AN ASSERTION MESSAGE\",\"range\":[46,76]}],\"range\":[0,77]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"ok\",\"range\":[7,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"this\"},\"value\":\"this\",\"range\":[10,14]},{\"type\":{\"label\":\".\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"ary\",\"range\":[15,18]},{\"type\":{\"label\":\".\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[19,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"two\",\"range\":[27,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[32,35]},{\"type\":{\"label\":\"name\"},\"value\":\"minusOne\",\"range\":[36,44]},{\"type\":{\"label\":\",\"},\"range\":[44,45]},{\"type\":{\"label\":\"string\"},\"value\":\"THIS IS AN ASSERTION MESSAGE\",\"range\":[46,76]},{\"type\":{\"label\":\")\"},\"range\":[76,77]}]", - visitorKeys: _powerAssertVisitorKeys - }), 'THIS IS AN ASSERTION MESSAGE'); + assert.ok(_ag2._rec(_ag2._tap(_ag2._tap(this.ary, "arguments/0/left/callee/object").indexOf(_ag2._tap(two, "arguments/0/left/arguments/0")), "arguments/0/left") === _ag2._tap(minusOne, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, 1, 'THIS IS AN ASSERTION MESSAGE')); }); }); diff --git a/test/fixtures/Mocha/expected.js b/test/fixtures/Mocha/expected.js index da488a3..5d45138 100644 --- a/test/fixtures/Mocha/expected.js +++ b/test/fixtures/Mocha/expected.js @@ -1,6 +1,9 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); var assert = require('power-assert'); @@ -9,25 +12,19 @@ describe('Array#indexOf()', function () { this.ary = [1, 2, 3]; }); it('should return index when the value is present', function () { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert(this.ary.indexOf(who) === two)", "test/fixtures/Mocha/fixture.js", 11), + _ag = new _ArgumentRecorder(assert, _am, 0); var who = 'ariya', two = 2; - assert(_rec._expr(_rec._capt(_rec._capt(_rec._capt(this.ary, "arguments/0/left/callee/object").indexOf(_rec._capt(who, "arguments/0/left/arguments/0")), "arguments/0/left") === _rec._capt(two, "arguments/0/right"), "arguments/0"), { - content: "assert(this.ary.indexOf(who) === two)", - filepath: "test/fixtures/Mocha/fixture.js", - line: 11 - })); + assert(_ag._rec(_ag._tap(_ag._tap(this.ary, "arguments/0/left/callee/object").indexOf(_ag._tap(who, "arguments/0/left/arguments/0")), "arguments/0/left") === _ag._tap(two, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); }); it('should return -1 when the value is not present', function () { - var _rec2 = new _powerAssertRecorder(); + var _am2 = _pwmeta(1, "assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE')", "test/fixtures/Mocha/fixture.js", 15), + _ag2 = new _ArgumentRecorder(assert.ok, _am2, 0); var minusOne = -1, two = 2; - assert.ok(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(this.ary, "arguments/0/left/callee/object").indexOf(_rec2._capt(two, "arguments/0/left/arguments/0")), "arguments/0/left") === _rec2._capt(minusOne, "arguments/0/right"), "arguments/0"), { - content: "assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE')", - filepath: "test/fixtures/Mocha/fixture.js", - line: 15 - }), 'THIS IS AN ASSERTION MESSAGE'); + assert.ok(_ag2._rec(_ag2._tap(_ag2._tap(this.ary, "arguments/0/left/callee/object").indexOf(_ag2._tap(two, "arguments/0/left/arguments/0")), "arguments/0/left") === _ag2._tap(minusOne, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, 1, 'THIS IS AN ASSERTION MESSAGE')); }); }); diff --git a/test/fixtures/NewExpression/expected-presets-env.js b/test/fixtures/NewExpression/expected-presets-env.js index c41bf8c..0ee08ca 100644 --- a/test/fixtures/NewExpression/expected-presets-env.js +++ b/test/fixtures/NewExpression/expected-presets-env.js @@ -1,49 +1,45 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(new Date(), "arguments/0"), { - content: "assert(new Date())", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(new Date())", "test/fixtures/NewExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Date\",\"range\":[11,15]},\"arguments\":[],\"range\":[7,17]}],\"range\":[0,18]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[7,10]},{\"type\":{\"label\":\"name\"},\"value\":\"Date\",\"range\":[11,15]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(new (_rec2._capt(_rec2._capt(foo, "arguments/0/callee/object/object").bar, "arguments/0/callee/object").Baz)(), "arguments/0"), { - content: "assert(new foo.bar.Baz())", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(new foo.bar.Baz())", "test/fixtures/NewExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"NewExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[11,14]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[15,18]},\"computed\":false,\"range\":[11,18]},\"property\":{\"type\":\"Identifier\",\"name\":\"Baz\",\"range\":[19,22]},\"computed\":false,\"range\":[11,22]},\"arguments\":[],\"range\":[7,24]}],\"range\":[0,25]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[7,10]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[11,14]},{\"type\":{\"label\":\".\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[15,18]},{\"type\":{\"label\":\".\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"Baz\",\"range\":[19,22]},{\"type\":{\"label\":\"(\"},\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(!_rec3._capt(new Array(_rec3._capt(foo, "arguments/0/argument/arguments/0"), _rec3._capt(bar, "arguments/0/argument/arguments/1"), _rec3._capt(baz, "arguments/0/argument/arguments/2")), "arguments/0/argument"), "arguments/0"), { - content: "assert(!new Array(foo, bar, baz))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(!new Array(foo, bar, baz))", "test/fixtures/NewExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Array\",\"range\":[12,17]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[18,21]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[23,26]},{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[28,31]}],\"range\":[8,32]},\"prefix\":true,\"range\":[7,32]}],\"range\":[0,33]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[8,11]},{\"type\":{\"label\":\"name\"},\"value\":\"Array\",\"range\":[12,17]},{\"type\":{\"label\":\"(\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[18,21]},{\"type\":{\"label\":\",\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[23,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[28,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.notEqual(_rec4._expr(_rec4._capt(new Date(), "arguments/0"), { - content: "assert.notEqual(new Date(), new Date('2013-01-12'))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(3, "assert.notEqual(new Date(), new Date('2013-01-12'))", "test/fixtures/NewExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"notEqual\",\"range\":[7,15]},\"computed\":false,\"range\":[0,15]},\"arguments\":[{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Date\",\"range\":[20,24]},\"arguments\":[],\"range\":[16,26]},{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Date\",\"range\":[32,36]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\"2013-01-12\",\"range\":[37,49]}],\"range\":[28,50]}],\"range\":[0,51]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"notEqual\",\"range\":[7,15]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[16,19]},{\"type\":{\"label\":\"name\"},\"value\":\"Date\",\"range\":[20,24]},{\"type\":{\"label\":\"(\"},\"range\":[24,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[28,31]},{\"type\":{\"label\":\"name\"},\"value\":\"Date\",\"range\":[32,36]},{\"type\":{\"label\":\"(\"},\"range\":[36,37]},{\"type\":{\"label\":\"string\"},\"value\":\"2013-01-12\",\"range\":[37,49]},{\"type\":{\"label\":\")\"},\"range\":[49,50]},{\"type\":{\"label\":\")\"},\"range\":[50,51]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec5._expr(_rec5._capt(new Date('2013-01-12'), "arguments/1"), { - content: "assert.notEqual(new Date(), new Date('2013-01-12'))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 9, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"notEqual\",\"range\":[7,15]},\"computed\":false,\"range\":[0,15]},\"arguments\":[{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Date\",\"range\":[20,24]},\"arguments\":[],\"range\":[16,26]},{\"type\":\"NewExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"Date\",\"range\":[32,36]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\"2013-01-12\",\"range\":[37,49]}],\"range\":[28,50]}],\"range\":[0,51]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"notEqual\",\"range\":[7,15]},{\"type\":{\"label\":\"(\"},\"range\":[15,16]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[16,19]},{\"type\":{\"label\":\"name\"},\"value\":\"Date\",\"range\":[20,24]},{\"type\":{\"label\":\"(\"},\"range\":[24,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"new\"},\"value\":\"new\",\"range\":[28,31]},{\"type\":{\"label\":\"name\"},\"value\":\"Date\",\"range\":[32,36]},{\"type\":{\"label\":\"(\"},\"range\":[36,37]},{\"type\":{\"label\":\"string\"},\"value\":\"2013-01-12\",\"range\":[37,49]},{\"type\":{\"label\":\")\"},\"range\":[49,50]},{\"type\":{\"label\":\")\"},\"range\":[50,51]}]", - visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag4 = new _ArgumentRecorder(assert.notEqual, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.notEqual, _am4, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(new Date(), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(new (_ag2._tap(_ag2._tap(foo, "arguments/0/callee/object/object").bar, "arguments/0/callee/object").Baz)(), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(!_ag3._tap(new Array(_ag3._tap(foo, "arguments/0/argument/arguments/0"), _ag3._tap(bar, "arguments/0/argument/arguments/1"), _ag3._tap(baz, "arguments/0/argument/arguments/2")), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert.notEqual(_ag4._rec(new Date(), "arguments/0"), _ag5._rec(new Date('2013-01-12'), "arguments/1"), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/NewExpression/expected.js b/test/fixtures/NewExpression/expected.js index 96db9a3..d853047 100644 --- a/test/fixtures/NewExpression/expected.js +++ b/test/fixtures/NewExpression/expected.js @@ -1,33 +1,20 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(new Date())", "test/fixtures/NewExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(new foo.bar.Baz())", "test/fixtures/NewExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(!new Array(foo, bar, baz))", "test/fixtures/NewExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(3, "assert.notEqual(new Date(), new Date('2013-01-12'))", "test/fixtures/NewExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert.notEqual, _am4, 0), + _ag5 = new _ArgumentRecorder(assert.notEqual, _am4, 1); -assert(_rec._expr(_rec._capt(new Date(), "arguments/0"), { - content: "assert(new Date())", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(new (_rec2._capt(_rec2._capt(foo, "arguments/0/callee/object/object").bar, "arguments/0/callee/object").Baz)(), "arguments/0"), { - content: "assert(new foo.bar.Baz())", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(!_rec3._capt(new Array(_rec3._capt(foo, "arguments/0/argument/arguments/0"), _rec3._capt(bar, "arguments/0/argument/arguments/1"), _rec3._capt(baz, "arguments/0/argument/arguments/2")), "arguments/0/argument"), "arguments/0"), { - content: "assert(!new Array(foo, bar, baz))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 7 -})); -assert.notEqual(_rec4._expr(_rec4._capt(new Date(), "arguments/0"), { - content: "assert.notEqual(new Date(), new Date('2013-01-12'))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 9 -}), _rec5._expr(_rec5._capt(new Date('2013-01-12'), "arguments/1"), { - content: "assert.notEqual(new Date(), new Date('2013-01-12'))", - filepath: "test/fixtures/NewExpression/fixture.js", - line: 9 -})); +assert(_ag._rec(new Date(), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(new (_ag2._tap(_ag2._tap(foo, "arguments/0/callee/object/object").bar, "arguments/0/callee/object").Baz)(), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(!_ag3._tap(new Array(_ag3._tap(foo, "arguments/0/argument/arguments/0"), _ag3._tap(bar, "arguments/0/argument/arguments/1"), _ag3._tap(baz, "arguments/0/argument/arguments/2")), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert.notEqual(_ag4._rec(new Date(), "arguments/0"), _ag5._rec(new Date('2013-01-12'), "arguments/1"), new _AssertionMessage(_am4, -1)); diff --git a/test/fixtures/ObjectExpression/expected-presets-env.js b/test/fixtures/ObjectExpression/expected-presets-env.js index 467e695..9ec4d58 100644 --- a/test/fixtures/ObjectExpression/expected-presets-env.js +++ b/test/fixtures/ObjectExpression/expected-presets-env.js @@ -1,55 +1,53 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt({ - foo: _rec._capt(bar, "arguments/0/properties/0/value"), - hoge: _rec._capt(fuga, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert({ foo: bar, hoge: fuga })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert({ foo: bar, hoge: fuga })", "test/fixtures/ObjectExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"value\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[14,17]},\"computed\":false,\"shorthand\":false,\"range\":[9,17]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[19,23]},\"value\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[25,29]},\"computed\":false,\"shorthand\":false,\"range\":[19,29]}],\"range\":[7,31]}],\"range\":[0,32]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[9,12]},{\"type\":{\"label\":\":\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[14,17]},{\"type\":{\"label\":\",\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[19,23]},{\"type\":{\"label\":\":\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[25,29]},{\"type\":{\"label\":\"}\"},\"range\":[30,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(!_rec2._capt({ - foo: _rec2._capt(_rec2._capt(bar, "arguments/0/argument/properties/0/value/object").baz, "arguments/0/argument/properties/0/value"), - name: _rec2._capt(nameOf(_rec2._capt({ - firstName: _rec2._capt(first, "arguments/0/argument/properties/1/value/arguments/0/properties/0/value"), - lastName: _rec2._capt(last, "arguments/0/argument/properties/1/value/arguments/0/properties/1/value") - }, "arguments/0/argument/properties/1/value/arguments/0")), "arguments/0/argument/properties/1/value") -}, "arguments/0/argument"), "arguments/0"), { - content: "assert(!{ foo: bar.baz, name: nameOf({ firstName: first, lastName: last }) })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(!{ foo: bar.baz, name: nameOf({ firstName: first, lastName: last }) })", "test/fixtures/ObjectExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[10,13]},\"value\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[15,18]},\"property\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[19,22]},\"computed\":false,\"range\":[15,22]},\"computed\":false,\"shorthand\":false,\"range\":[10,22]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"name\",\"range\":[24,28]},\"value\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"nameOf\",\"range\":[30,36]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"firstName\",\"range\":[39,48]},\"value\":{\"type\":\"Identifier\",\"name\":\"first\",\"range\":[50,55]},\"computed\":false,\"shorthand\":false,\"range\":[39,55]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"lastName\",\"range\":[57,65]},\"value\":{\"type\":\"Identifier\",\"name\":\"last\",\"range\":[67,71]},\"computed\":false,\"shorthand\":false,\"range\":[57,71]}],\"range\":[37,73]}],\"range\":[30,74]},\"computed\":false,\"shorthand\":false,\"range\":[24,74]}],\"range\":[8,76]},\"prefix\":true,\"range\":[7,76]}],\"range\":[0,77]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"{\"},\"range\":[8,9]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[10,13]},{\"type\":{\"label\":\":\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[15,18]},{\"type\":{\"label\":\".\"},\"range\":[18,19]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[19,22]},{\"type\":{\"label\":\",\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"name\",\"range\":[24,28]},{\"type\":{\"label\":\":\"},\"range\":[28,29]},{\"type\":{\"label\":\"name\"},\"value\":\"nameOf\",\"range\":[30,36]},{\"type\":{\"label\":\"(\"},\"range\":[36,37]},{\"type\":{\"label\":\"{\"},\"range\":[37,38]},{\"type\":{\"label\":\"name\"},\"value\":\"firstName\",\"range\":[39,48]},{\"type\":{\"label\":\":\"},\"range\":[48,49]},{\"type\":{\"label\":\"name\"},\"value\":\"first\",\"range\":[50,55]},{\"type\":{\"label\":\",\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"lastName\",\"range\":[57,65]},{\"type\":{\"label\":\":\"},\"range\":[65,66]},{\"type\":{\"label\":\"name\"},\"value\":\"last\",\"range\":[67,71]},{\"type\":{\"label\":\"}\"},\"range\":[72,73]},{\"type\":{\"label\":\")\"},\"range\":[73,74]},{\"type\":{\"label\":\"}\"},\"range\":[75,76]},{\"type\":{\"label\":\")\"},\"range\":[76,77]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.deepEqual(_rec3._expr(_rec3._capt({ - foo: _rec3._capt(bar, "arguments/0/properties/0/value"), - hoge: _rec3._capt(fuga, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 7, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"deepEqual\",\"range\":[7,16]},\"computed\":false,\"range\":[0,16]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[19,22]},\"value\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[24,27]},\"computed\":false,\"shorthand\":false,\"range\":[19,27]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[29,33]},\"value\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[35,39]},\"computed\":false,\"shorthand\":false,\"range\":[29,39]}],\"range\":[17,41]},{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[45,49]},\"value\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[51,55]},\"computed\":false,\"shorthand\":false,\"range\":[45,55]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[57,60]},\"value\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[62,65]},\"computed\":false,\"shorthand\":false,\"range\":[57,65]}],\"range\":[43,67]}],\"range\":[0,68]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"deepEqual\",\"range\":[7,16]},{\"type\":{\"label\":\"(\"},\"range\":[16,17]},{\"type\":{\"label\":\"{\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[19,22]},{\"type\":{\"label\":\":\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[24,27]},{\"type\":{\"label\":\",\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[29,33]},{\"type\":{\"label\":\":\"},\"range\":[33,34]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[35,39]},{\"type\":{\"label\":\"}\"},\"range\":[40,41]},{\"type\":{\"label\":\",\"},\"range\":[41,42]},{\"type\":{\"label\":\"{\"},\"range\":[43,44]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[45,49]},{\"type\":{\"label\":\":\"},\"range\":[49,50]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[51,55]},{\"type\":{\"label\":\",\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[57,60]},{\"type\":{\"label\":\":\"},\"range\":[60,61]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[62,65]},{\"type\":{\"label\":\"}\"},\"range\":[66,67]},{\"type\":{\"label\":\")\"},\"range\":[67,68]}]", - visitorKeys: _powerAssertVisitorKeys -}), _rec4._expr(_rec4._capt({ - hoge: _rec4._capt(fuga, "arguments/1/properties/0/value"), - foo: _rec4._capt(bar, "arguments/1/properties/1/value") -}, "arguments/1"), { - content: "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(6, "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", "test/fixtures/ObjectExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"deepEqual\",\"range\":[7,16]},\"computed\":false,\"range\":[0,16]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[19,22]},\"value\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[24,27]},\"computed\":false,\"shorthand\":false,\"range\":[19,27]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[29,33]},\"value\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[35,39]},\"computed\":false,\"shorthand\":false,\"range\":[29,39]}],\"range\":[17,41]},{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"hoge\",\"range\":[45,49]},\"value\":{\"type\":\"Identifier\",\"name\":\"fuga\",\"range\":[51,55]},\"computed\":false,\"shorthand\":false,\"range\":[45,55]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[57,60]},\"value\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[62,65]},\"computed\":false,\"shorthand\":false,\"range\":[57,65]}],\"range\":[43,67]}],\"range\":[0,68]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"deepEqual\",\"range\":[7,16]},{\"type\":{\"label\":\"(\"},\"range\":[16,17]},{\"type\":{\"label\":\"{\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[19,22]},{\"type\":{\"label\":\":\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[24,27]},{\"type\":{\"label\":\",\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[29,33]},{\"type\":{\"label\":\":\"},\"range\":[33,34]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[35,39]},{\"type\":{\"label\":\"}\"},\"range\":[40,41]},{\"type\":{\"label\":\",\"},\"range\":[41,42]},{\"type\":{\"label\":\"{\"},\"range\":[43,44]},{\"type\":{\"label\":\"name\"},\"value\":\"hoge\",\"range\":[45,49]},{\"type\":{\"label\":\":\"},\"range\":[49,50]},{\"type\":{\"label\":\"name\"},\"value\":\"fuga\",\"range\":[51,55]},{\"type\":{\"label\":\",\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[57,60]},{\"type\":{\"label\":\":\"},\"range\":[60,61]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[62,65]},{\"type\":{\"label\":\"}\"},\"range\":[66,67]},{\"type\":{\"label\":\")\"},\"range\":[67,68]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag3 = new _ArgumentRecorder(assert.deepEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.deepEqual, _am3, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec({ + foo: _ag._tap(bar, "arguments/0/properties/0/value"), + hoge: _ag._tap(fuga, "arguments/0/properties/1/value") +}, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(!_ag2._tap({ + foo: _ag2._tap(_ag2._tap(bar, "arguments/0/argument/properties/0/value/object").baz, "arguments/0/argument/properties/0/value"), + name: _ag2._tap(nameOf(_ag2._tap({ + firstName: _ag2._tap(first, "arguments/0/argument/properties/1/value/arguments/0/properties/0/value"), + lastName: _ag2._tap(last, "arguments/0/argument/properties/1/value/arguments/0/properties/1/value") + }, "arguments/0/argument/properties/1/value/arguments/0")), "arguments/0/argument/properties/1/value") +}, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.deepEqual(_ag3._rec({ + foo: _ag3._tap(bar, "arguments/0/properties/0/value"), + hoge: _ag3._tap(fuga, "arguments/0/properties/1/value") +}, "arguments/0"), _ag4._rec({ + hoge: _ag4._tap(fuga, "arguments/1/properties/0/value"), + foo: _ag4._tap(bar, "arguments/1/properties/1/value") +}, "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/ObjectExpression/expected.js b/test/fixtures/ObjectExpression/expected.js index 9a0e299..58caefd 100644 --- a/test/fixtures/ObjectExpression/expected.js +++ b/test/fixtures/ObjectExpression/expected.js @@ -1,42 +1,32 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert({ foo: bar, hoge: fuga })", "test/fixtures/ObjectExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(!{ foo: bar.baz, name: nameOf({ firstName: first, lastName: last }) })", "test/fixtures/ObjectExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(6, "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", "test/fixtures/ObjectExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert.deepEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.deepEqual, _am3, 1); -assert(_rec._expr(_rec._capt({ - foo: _rec._capt(bar, "arguments/0/properties/0/value"), - hoge: _rec._capt(fuga, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert({ foo: bar, hoge: fuga })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(!_rec2._capt({ - foo: _rec2._capt(_rec2._capt(bar, "arguments/0/argument/properties/0/value/object").baz, "arguments/0/argument/properties/0/value"), - name: _rec2._capt(nameOf(_rec2._capt({ - firstName: _rec2._capt(first, "arguments/0/argument/properties/1/value/arguments/0/properties/0/value"), - lastName: _rec2._capt(last, "arguments/0/argument/properties/1/value/arguments/0/properties/1/value") +assert(_ag._rec({ + foo: _ag._tap(bar, "arguments/0/properties/0/value"), + hoge: _ag._tap(fuga, "arguments/0/properties/1/value") +}, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(!_ag2._tap({ + foo: _ag2._tap(_ag2._tap(bar, "arguments/0/argument/properties/0/value/object").baz, "arguments/0/argument/properties/0/value"), + name: _ag2._tap(nameOf(_ag2._tap({ + firstName: _ag2._tap(first, "arguments/0/argument/properties/1/value/arguments/0/properties/0/value"), + lastName: _ag2._tap(last, "arguments/0/argument/properties/1/value/arguments/0/properties/1/value") }, "arguments/0/argument/properties/1/value/arguments/0")), "arguments/0/argument/properties/1/value") -}, "arguments/0/argument"), "arguments/0"), { - content: "assert(!{ foo: bar.baz, name: nameOf({ firstName: first, lastName: last }) })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 5 -})); -assert.deepEqual(_rec3._expr(_rec3._capt({ - foo: _rec3._capt(bar, "arguments/0/properties/0/value"), - hoge: _rec3._capt(fuga, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 7 -}), _rec4._expr(_rec4._capt({ - hoge: _rec4._capt(fuga, "arguments/1/properties/0/value"), - foo: _rec4._capt(bar, "arguments/1/properties/1/value") -}, "arguments/1"), { - content: "assert.deepEqual({ foo: bar, hoge: fuga }, { hoge: fuga, foo: bar })", - filepath: "test/fixtures/ObjectExpression/fixture.js", - line: 7 -})); +}, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.deepEqual(_ag3._rec({ + foo: _ag3._tap(bar, "arguments/0/properties/0/value"), + hoge: _ag3._tap(fuga, "arguments/0/properties/1/value") +}, "arguments/0"), _ag4._rec({ + hoge: _ag4._tap(fuga, "arguments/1/properties/0/value"), + foo: _ag4._tap(bar, "arguments/1/properties/1/value") +}, "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/ObjectRestSpread/expected-presets-env.js b/test/fixtures/ObjectRestSpread/expected-presets-env.js index d5f407a..9730fe8 100644 --- a/test/fixtures/ObjectRestSpread/expected-presets-env.js +++ b/test/fixtures/ObjectRestSpread/expected-presets-env.js @@ -1,18 +1,27 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(obj == { ...obj })", "test/fixtures/ObjectRestSpread/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"==\",\"left\":{\"type\":\"Identifier\",\"name\":\"obj\",\"range\":[7,10]},\"right\":{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"Identifier\",\"name\":\"obj\",\"range\":[19,22]},\"range\":[16,22]}],\"range\":[14,24]},\"range\":[7,24]}],\"range\":[0,25]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"obj\",\"range\":[7,10]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"==\",\"range\":[11,13]},{\"type\":{\"label\":\"{\"},\"range\":[14,15]},{\"type\":{\"label\":\"...\"},\"range\":[16,19]},{\"type\":{\"label\":\"name\"},\"value\":\"obj\",\"range\":[19,22]},{\"type\":{\"label\":\"}\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -assert(_rec._expr(_rec._capt(_rec._capt(obj, "arguments/0/left") == _rec._capt(_objectSpread({}, _rec._capt(obj, "arguments/0/right/properties/0/argument")), "arguments/0/right"), "arguments/0"), { - content: "assert(obj == { ...obj })", - filepath: "test/fixtures/ObjectRestSpread/fixture.js", - line: 3, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"==\",\"left\":{\"type\":\"Identifier\",\"name\":\"obj\",\"range\":[7,10]},\"right\":{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"Identifier\",\"name\":\"obj\",\"range\":[19,22]},\"range\":[16,22]}],\"range\":[14,24]},\"range\":[7,24]}],\"range\":[0,25]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"obj\",\"range\":[7,10]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"==\",\"range\":[11,13]},{\"type\":{\"label\":\"{\"},\"range\":[14,15]},{\"type\":{\"label\":\"...\"},\"range\":[16,19]},{\"type\":{\"label\":\"name\"},\"value\":\"obj\",\"range\":[19,22]},{\"type\":{\"label\":\"}\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", - visitorKeys: _powerAssertVisitorKeys -})); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(_ag._tap(obj, "arguments/0/left") == _ag._tap(_objectSpread({}, _ag._tap(obj, "arguments/0/right/properties/0/argument")), "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); diff --git a/test/fixtures/Property/expected-presets-env.js b/test/fixtures/Property/expected-presets-env.js index b3c0c21..6e4f64c 100644 --- a/test/fixtures/Property/expected-presets-env.js +++ b/test/fixtures/Property/expected-presets-env.js @@ -1,59 +1,60 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -assert(_rec._expr(_rec._capt(_defineProperty({}, _rec._capt(num, "arguments/0/properties/0/key"), _rec._capt(foo, "arguments/0/properties/0/value")), "arguments/0"), { - content: "assert({ [num]: foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert({ [num]: foo })", "test/fixtures/Property/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"num\",\"range\":[10,13]},\"value\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[16,19]},\"computed\":true,\"shorthand\":false,\"range\":[9,19]}],\"range\":[7,21]}],\"range\":[0,22]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"[\"},\"range\":[9,10]},{\"type\":{\"label\":\"name\"},\"value\":\"num\",\"range\":[10,13]},{\"type\":{\"label\":\"]\"},\"range\":[13,14]},{\"type\":{\"label\":\":\"},\"range\":[14,15]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[16,19]},{\"type\":{\"label\":\"}\"},\"range\":[20,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_defineProperty({}, _rec2._capt('prop_' + _rec2._capt(function () { - return bar(); -}(), "arguments/0/properties/0/key/right"), "arguments/0/properties/0/key"), 42), "arguments/0"), { - content: "assert({ ['prop_' + (() => bar())()]: 42 })", - filepath: "test/fixtures/Property/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert({ ['prop_' + (() => bar())()]: 42 })", "test/fixtures/Property/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"BinaryExpression\",\"operator\":\"+\",\"left\":{\"type\":\"StringLiteral\",\"value\":\"prop_\",\"range\":[10,17]},\"right\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"ArrowFunctionExpression\",\"params\":[],\"body\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[27,30]},\"arguments\":[],\"range\":[27,32]},\"async\":false,\"range\":[21,32]},\"arguments\":[],\"range\":[20,35]},\"range\":[10,35]},\"value\":{\"type\":\"NumericLiteral\",\"value\":42,\"range\":[38,40]},\"computed\":true,\"shorthand\":false,\"range\":[9,40]}],\"range\":[7,42]}],\"range\":[0,43]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"[\"},\"range\":[9,10]},{\"type\":{\"label\":\"string\"},\"value\":\"prop_\",\"range\":[10,17]},{\"type\":{\"label\":\"+/-\"},\"value\":\"+\",\"range\":[18,19]},{\"type\":{\"label\":\"(\"},\"range\":[20,21]},{\"type\":{\"label\":\"(\"},\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]},{\"type\":{\"label\":\"=>\"},\"range\":[24,26]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[27,30]},{\"type\":{\"label\":\"(\"},\"range\":[30,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]},{\"type\":{\"label\":\"(\"},\"range\":[33,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]},{\"type\":{\"label\":\"]\"},\"range\":[35,36]},{\"type\":{\"label\":\":\"},\"range\":[36,37]},{\"type\":{\"label\":\"num\"},\"value\":42,\"range\":[38,40]},{\"type\":{\"label\":\"}\"},\"range\":[41,42]},{\"type\":{\"label\":\")\"},\"range\":[42,43]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(_defineProperty({}, _rec3._capt("prop_".concat(_rec3._capt(generate(_rec3._capt(seed, "arguments/0/properties/0/key/expressions/0/arguments/0")), "arguments/0/properties/0/key/expressions/0")), "arguments/0/properties/0/key"), _rec3._capt(foo, "arguments/0/properties/0/value")), "arguments/0"), { - content: "assert({ [`prop_${generate(seed)}`]: foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert({ [`prop_${generate(seed)}`]: foo })", "test/fixtures/Property/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"prop_\",\"cooked\":\"prop_\"},\"tail\":false,\"range\":[11,16]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[33,33]}],\"expressions\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"generate\",\"range\":[18,26]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"seed\",\"range\":[27,31]}],\"range\":[18,32]}],\"range\":[10,34]},\"value\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[37,40]},\"computed\":true,\"shorthand\":false,\"range\":[9,40]}],\"range\":[7,42]}],\"range\":[0,43]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"[\"},\"range\":[9,10]},{\"type\":{\"label\":\"`\"},\"range\":[10,11]},{\"type\":{\"label\":\"template\"},\"value\":\"prop_\",\"range\":[11,16]},{\"type\":{\"label\":\"${\"},\"range\":[16,18]},{\"type\":{\"label\":\"name\"},\"value\":\"generate\",\"range\":[18,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"name\"},\"value\":\"seed\",\"range\":[27,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]},{\"type\":{\"label\":\"}\"},\"range\":[32,33]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[33,33]},{\"type\":{\"label\":\"`\"},\"range\":[33,34]},{\"type\":{\"label\":\"]\"},\"range\":[34,35]},{\"type\":{\"label\":\":\"},\"range\":[35,36]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[37,40]},{\"type\":{\"label\":\"}\"},\"range\":[41,42]},{\"type\":{\"label\":\")\"},\"range\":[42,43]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt({ - foo: foo -}, "arguments/0"), { - content: "assert({ foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert({ foo })", "test/fixtures/Property/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"value\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"computed\":false,\"shorthand\":true,\"range\":[9,12]}],\"range\":[7,14]}],\"range\":[0,15]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[9,12]},{\"type\":{\"label\":\"}\"},\"range\":[13,14]},{\"type\":{\"label\":\")\"},\"range\":[14,15]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr(_rec5._capt({ - foo: foo, - bar: _rec5._capt(baz, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert({ foo, bar: baz })", - filepath: "test/fixtures/Property/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert({ foo, bar: baz })", "test/fixtures/Property/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"ObjectExpression\",\"properties\":[{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"value\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"computed\":false,\"shorthand\":true,\"range\":[9,12]},{\"type\":\"ObjectProperty\",\"key\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[14,17]},\"value\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[19,22]},\"computed\":false,\"shorthand\":false,\"range\":[14,22]}],\"range\":[7,24]}],\"range\":[0,25]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"{\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[9,12]},{\"type\":{\"label\":\",\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[14,17]},{\"type\":{\"label\":\":\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[19,22]},{\"type\":{\"label\":\"}\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0); + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(_defineProperty({}, _ag._tap(num, "arguments/0/properties/0/key"), _ag._tap(foo, "arguments/0/properties/0/value")), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_defineProperty({}, _ag2._tap('prop_' + _ag2._tap(function () { + return bar(); +}(), "arguments/0/properties/0/key/right"), "arguments/0/properties/0/key"), 42), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(_defineProperty({}, _ag3._tap("prop_".concat(_ag3._tap(generate(_ag3._tap(seed, "arguments/0/properties/0/key/expressions/0/arguments/0")), "arguments/0/properties/0/key/expressions/0")), "arguments/0/properties/0/key"), _ag3._tap(foo, "arguments/0/properties/0/value")), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec({ + foo: foo +}, "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec({ + foo: foo, + bar: _ag5._tap(baz, "arguments/0/properties/1/value") +}, "arguments/0"), new _AssertionMessage(_am5, -1)); diff --git a/test/fixtures/Property/expected.js b/test/fixtures/Property/expected.js index cdf952f..1491eee 100644 --- a/test/fixtures/Property/expected.js +++ b/test/fixtures/Property/expected.js @@ -1,45 +1,33 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert({ [num]: foo })", "test/fixtures/Property/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert({ ['prop_' + (() => bar())()]: 42 })", "test/fixtures/Property/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert({ [`prop_${generate(seed)}`]: foo })", "test/fixtures/Property/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert({ foo })", "test/fixtures/Property/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert({ foo, bar: baz })", "test/fixtures/Property/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert, _am5, 0); -assert(_rec._expr(_rec._capt({ - [_rec._capt(num, "arguments/0/properties/0/key")]: _rec._capt(foo, "arguments/0/properties/0/value") -}, "arguments/0"), { - content: "assert({ [num]: foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt({ - [_rec2._capt('prop_' + _rec2._capt((() => bar())(), "arguments/0/properties/0/key/right"), "arguments/0/properties/0/key")]: 42 -}, "arguments/0"), { - content: "assert({ ['prop_' + (() => bar())()]: 42 })", - filepath: "test/fixtures/Property/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt({ - [_rec3._capt(`prop_${_rec3._capt(generate(_rec3._capt(seed, "arguments/0/properties/0/key/expressions/0/arguments/0")), "arguments/0/properties/0/key/expressions/0")}`, "arguments/0/properties/0/key")]: _rec3._capt(foo, "arguments/0/properties/0/value") -}, "arguments/0"), { - content: "assert({ [`prop_${generate(seed)}`]: foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt({ +assert(_ag._rec({ + [_ag._tap(num, "arguments/0/properties/0/key")]: _ag._tap(foo, "arguments/0/properties/0/value") +}, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec({ + [_ag2._tap('prop_' + _ag2._tap((() => bar())(), "arguments/0/properties/0/key/right"), "arguments/0/properties/0/key")]: 42 +}, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec({ + [_ag3._tap(`prop_${_ag3._tap(generate(_ag3._tap(seed, "arguments/0/properties/0/key/expressions/0/arguments/0")), "arguments/0/properties/0/key/expressions/0")}`, "arguments/0/properties/0/key")]: _ag3._tap(foo, "arguments/0/properties/0/value") +}, "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec({ foo -}, "arguments/0"), { - content: "assert({ foo })", - filepath: "test/fixtures/Property/fixture.js", - line: 9 -})); -assert(_rec5._expr(_rec5._capt({ +}, "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec({ foo, - bar: _rec5._capt(baz, "arguments/0/properties/1/value") -}, "arguments/0"), { - content: "assert({ foo, bar: baz })", - filepath: "test/fixtures/Property/fixture.js", - line: 11 -})); + bar: _ag5._tap(baz, "arguments/0/properties/1/value") +}, "arguments/0"), new _AssertionMessage(_am5, -1)); diff --git a/test/fixtures/React/expected-presets-react.js b/test/fixtures/React/expected-presets-react.js index e84ab59..0dd1849 100644 --- a/test/fixtures/React/expected-presets-react.js +++ b/test/fixtures/React/expected-presets-react.js @@ -10,20 +10,15 @@ var sinon = _interopRequireWildcard(require("sinon")); var _Foo = _interopRequireDefault(require("../src/Foo")); -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } @@ -35,6 +30,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + var ToDoItem = /*#__PURE__*/ function (_React$Component) { @@ -52,13 +55,13 @@ function (_React$Component) { var _this$props = this.props, item = _this$props.item, onCompleteChange = _this$props.onCompleteChange; - return _react.default.createElement("div", { + return _react["default"].createElement("div", { className: "item" - }, _react.default.createElement("span", { + }, _react["default"].createElement("span", { className: "item-mark" - }, item.complete ? '✓' : '•'), _react.default.createElement("span", { + }, item.complete ? '✓' : '•'), _react["default"].createElement("span", { className: "item-title" - }, item.title), _react.default.createElement("a", { + }, item.title), _react["default"].createElement("a", { className: "item-button", onClick: function onClick() { return onCompleteChange(item, !item.complete); @@ -68,131 +71,115 @@ function (_React$Component) { }]); return ToDoItem; -}(_react.default.Component); +}(_react["default"].Component); function mockItem(overrides) {// … create mock ToDo Item } describe('<ToDoItem />', function () { it('renders the title', function () { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert(shallow(<ToDoItem item={item} />).text().indexOf(item.title) !== -1)", "test/fixtures/React/fixture.js", 29, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[],\"range\":[7,47]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[48,55]},\"computed\":false,\"range\":[7,55]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[56,60]},\"property\":{\"type\":\"Identifier\",\"name\":\"title\",\"range\":[61,66]},\"computed\":false,\"range\":[56,66]}],\"range\":[7,67]},\"right\":{\"type\":\"UnaryExpression\",\"operator\":\"-\",\"argument\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[73,74]},\"prefix\":true,\"range\":[72,74]},\"range\":[7,74]}],\"range\":[0,75]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\")\"},\"range\":[46,47]},{\"type\":{\"label\":\".\"},\"range\":[47,48]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[48,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[56,60]},{\"type\":{\"label\":\".\"},\"range\":[60,61]},{\"type\":{\"label\":\"name\"},\"value\":\"title\",\"range\":[61,66]},{\"type\":{\"label\":\")\"},\"range\":[66,67]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[68,71]},{\"type\":{\"label\":\"+/-\"},\"value\":\"-\",\"range\":[72,73]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[73,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag = new _ArgumentRecorder(_powerAssert["default"], _am, 0); var item = mockItem(); - (0, _powerAssert.default)(_rec._expr(_rec._capt(_rec._capt(_rec._capt(_rec._capt((0, _enzyme.shallow)(_react.default.createElement(ToDoItem, { + assert(_ag._rec(_ag._tap(_ag._tap(_ag._tap((0, _enzyme.shallow)(_react["default"].createElement(ToDoItem, { item: item - })), "arguments/0/left/callee/object/callee/object").text(), "arguments/0/left/callee/object").indexOf(_rec._capt(_rec._capt(item, "arguments/0/left/arguments/0/object").title, "arguments/0/left/arguments/0")), "arguments/0/left") !== _rec._capt(-1, "arguments/0/right"), "arguments/0"), { - content: "assert(shallow(<ToDoItem item={item} />).text().indexOf(item.title) !== -1)", - filepath: "test/fixtures/React/fixture.js", - line: 29, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[],\"range\":[7,47]},\"property\":{\"type\":\"Identifier\",\"name\":\"indexOf\",\"range\":[48,55]},\"computed\":false,\"range\":[7,55]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[56,60]},\"property\":{\"type\":\"Identifier\",\"name\":\"title\",\"range\":[61,66]},\"computed\":false,\"range\":[56,66]}],\"range\":[7,67]},\"right\":{\"type\":\"UnaryExpression\",\"operator\":\"-\",\"argument\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[73,74]},\"prefix\":true,\"range\":[72,74]},\"range\":[7,74]}],\"range\":[0,75]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\")\"},\"range\":[46,47]},{\"type\":{\"label\":\".\"},\"range\":[47,48]},{\"type\":{\"label\":\"name\"},\"value\":\"indexOf\",\"range\":[48,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[56,60]},{\"type\":{\"label\":\".\"},\"range\":[60,61]},{\"type\":{\"label\":\"name\"},\"value\":\"title\",\"range\":[61,66]},{\"type\":{\"label\":\")\"},\"range\":[66,67]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[68,71]},{\"type\":{\"label\":\"+/-\"},\"value\":\"-\",\"range\":[72,73]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[73,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", - visitorKeys: _powerAssertVisitorKeys - })); + })), "arguments/0/left/callee/object/callee/object").text(), "arguments/0/left/callee/object").indexOf(_ag._tap(_ag._tap(item, "arguments/0/left/arguments/0/object").title, "arguments/0/left/arguments/0")), "arguments/0/left") !== _ag._tap(-1, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); }); it('renders a check mark when complete', function () { - var _rec2 = new _powerAssertRecorder(); + var _am2 = _pwmeta(0, "assert(shallow(<ToDoItem item={item} />).find('.item-mark').text() === '\u2713')", "test/fixtures/React/fixture.js", 33, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"find\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".item-mark\",\"range\":[46,58]}],\"range\":[7,59]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[60,64]},\"computed\":false,\"range\":[7,64]},\"arguments\":[],\"range\":[7,66]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u2713\",\"range\":[71,74]},\"range\":[7,74]}],\"range\":[0,75]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\"string\"},\"value\":\".item-mark\",\"range\":[46,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]},{\"type\":{\"label\":\".\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[60,64]},{\"type\":{\"label\":\"(\"},\"range\":[64,65]},{\"type\":{\"label\":\")\"},\"range\":[65,66]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[67,70]},{\"type\":{\"label\":\"string\"},\"value\":\"\u2713\",\"range\":[71,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag2 = new _ArgumentRecorder(_powerAssert["default"], _am2, 0); var item = mockItem({ complete: true }); - (0, _powerAssert.default)(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(_rec2._capt((0, _enzyme.shallow)(_react.default.createElement(ToDoItem, { + assert(_ag2._rec(_ag2._tap(_ag2._tap(_ag2._tap((0, _enzyme.shallow)(_react["default"].createElement(ToDoItem, { item: item - })), "arguments/0/left/callee/object/callee/object").find('.item-mark'), "arguments/0/left/callee/object").text(), "arguments/0/left") === '✓', "arguments/0"), { - content: "assert(shallow(<ToDoItem item={item} />).find('.item-mark').text() === '\u2713')", - filepath: "test/fixtures/React/fixture.js", - line: 33, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"find\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".item-mark\",\"range\":[46,58]}],\"range\":[7,59]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[60,64]},\"computed\":false,\"range\":[7,64]},\"arguments\":[],\"range\":[7,66]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u2713\",\"range\":[71,74]},\"range\":[7,74]}],\"range\":[0,75]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\"string\"},\"value\":\".item-mark\",\"range\":[46,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]},{\"type\":{\"label\":\".\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[60,64]},{\"type\":{\"label\":\"(\"},\"range\":[64,65]},{\"type\":{\"label\":\")\"},\"range\":[65,66]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[67,70]},{\"type\":{\"label\":\"string\"},\"value\":\"\u2713\",\"range\":[71,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", - visitorKeys: _powerAssertVisitorKeys - })); + })), "arguments/0/left/callee/object/callee/object").find('.item-mark'), "arguments/0/left/callee/object").text(), "arguments/0/left") === '✓', "arguments/0"), new _AssertionMessage(_am2, -1)); }); it('renders a bullet when not complete', function () { - var _rec3 = new _powerAssertRecorder(); + var _am3 = _pwmeta(0, "assert(shallow(<ToDoItem item={item} />).find('.item-mark').text() === '\u2022')", "test/fixtures/React/fixture.js", 37, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"find\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".item-mark\",\"range\":[46,58]}],\"range\":[7,59]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[60,64]},\"computed\":false,\"range\":[7,64]},\"arguments\":[],\"range\":[7,66]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u2022\",\"range\":[71,74]},\"range\":[7,74]}],\"range\":[0,75]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\"string\"},\"value\":\".item-mark\",\"range\":[46,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]},{\"type\":{\"label\":\".\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[60,64]},{\"type\":{\"label\":\"(\"},\"range\":[64,65]},{\"type\":{\"label\":\")\"},\"range\":[65,66]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[67,70]},{\"type\":{\"label\":\"string\"},\"value\":\"\u2022\",\"range\":[71,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag3 = new _ArgumentRecorder(_powerAssert["default"], _am3, 0); var item = mockItem({ complete: false }); - (0, _powerAssert.default)(_rec3._expr(_rec3._capt(_rec3._capt(_rec3._capt(_rec3._capt((0, _enzyme.shallow)(_react.default.createElement(ToDoItem, { + assert(_ag3._rec(_ag3._tap(_ag3._tap(_ag3._tap((0, _enzyme.shallow)(_react["default"].createElement(ToDoItem, { item: item - })), "arguments/0/left/callee/object/callee/object").find('.item-mark'), "arguments/0/left/callee/object").text(), "arguments/0/left") === '•', "arguments/0"), { - content: "assert(shallow(<ToDoItem item={item} />).find('.item-mark').text() === '\u2022')", - filepath: "test/fixtures/React/fixture.js", - line: 37, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"ToDoItem\",\"range\":[16,24]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"item\",\"range\":[25,29]},\"value\":{\"type\":\"JSXExpressionContainer\",\"expression\":{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[31,35]},\"range\":[30,36]},\"range\":[25,36]}],\"selfClosing\":true,\"range\":[15,39]},\"closingElement\":null,\"children\":[],\"range\":[15,39]}],\"range\":[7,40]},\"property\":{\"type\":\"Identifier\",\"name\":\"find\",\"range\":[41,45]},\"computed\":false,\"range\":[7,45]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".item-mark\",\"range\":[46,58]}],\"range\":[7,59]},\"property\":{\"type\":\"Identifier\",\"name\":\"text\",\"range\":[60,64]},\"computed\":false,\"range\":[7,64]},\"arguments\":[],\"range\":[7,66]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"\u2022\",\"range\":[71,74]},\"range\":[7,74]}],\"range\":[0,75]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"ToDoItem\",\"range\":[16,24]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"item\",\"range\":[25,29]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[29,30]},{\"type\":{\"label\":\"{\"},\"range\":[30,31]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[31,35]},{\"type\":{\"label\":\"}\"},\"range\":[35,36]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[37,38]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\".\"},\"range\":[40,41]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[41,45]},{\"type\":{\"label\":\"(\"},\"range\":[45,46]},{\"type\":{\"label\":\"string\"},\"value\":\".item-mark\",\"range\":[46,58]},{\"type\":{\"label\":\")\"},\"range\":[58,59]},{\"type\":{\"label\":\".\"},\"range\":[59,60]},{\"type\":{\"label\":\"name\"},\"value\":\"text\",\"range\":[60,64]},{\"type\":{\"label\":\"(\"},\"range\":[64,65]},{\"type\":{\"label\":\")\"},\"range\":[65,66]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[67,70]},{\"type\":{\"label\":\"string\"},\"value\":\"\u2022\",\"range\":[71,74]},{\"type\":{\"label\":\")\"},\"range\":[74,75]}]", - visitorKeys: _powerAssertVisitorKeys - })); + })), "arguments/0/left/callee/object/callee/object").find('.item-mark'), "arguments/0/left/callee/object").text(), "arguments/0/left") === '•', "arguments/0"), new _AssertionMessage(_am3, -1)); }); it('calls onCompleteChange handler with the right arguments when clicked', function () { - var _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(); + var _am4 = _pwmeta(0, "assert(spy.calledOnce === true)", "test/fixtures/React/fixture.js", 44, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"spy\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"calledOnce\",\"range\":[11,21]},\"computed\":false,\"range\":[7,21]},\"right\":{\"type\":\"BooleanLiteral\",\"value\":true,\"range\":[26,30]},\"range\":[7,30]}],\"range\":[0,31]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"spy\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"calledOnce\",\"range\":[11,21]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[22,25]},{\"type\":{\"label\":\"true\"},\"value\":\"true\",\"range\":[26,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag4 = new _ArgumentRecorder(_powerAssert["default"], _am4, 0), + _am5 = _pwmeta(0, "assert(spy.calledWith(item, false) === true)", "test/fixtures/React/fixture.js", 45, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"spy\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"calledWith\",\"range\":[11,21]},\"computed\":false,\"range\":[7,21]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[22,26]},{\"type\":\"BooleanLiteral\",\"value\":false,\"range\":[28,33]}],\"range\":[7,34]},\"right\":{\"type\":\"BooleanLiteral\",\"value\":true,\"range\":[39,43]},\"range\":[7,43]}],\"range\":[0,44]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"spy\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"calledWith\",\"range\":[11,21]},{\"type\":{\"label\":\"(\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[22,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"false\"},\"value\":\"false\",\"range\":[28,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[35,38]},{\"type\":{\"label\":\"true\"},\"value\":\"true\",\"range\":[39,43]},{\"type\":{\"label\":\")\"},\"range\":[43,44]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag5 = new _ArgumentRecorder(_powerAssert["default"], _am5, 0); var spy = sinon.spy(); var item = mockItem(); - var wrapper = (0, _enzyme.shallow)(_react.default.createElement(ToDoItem, { + var wrapper = (0, _enzyme.shallow)(_react["default"].createElement(ToDoItem, { item: item, onCompleteChange: spy })); wrapper.find('.item-button').simulate('click'); - (0, _powerAssert.default)(_rec4._expr(_rec4._capt(_rec4._capt(_rec4._capt(spy, "arguments/0/left/object").calledOnce, "arguments/0/left") === true, "arguments/0"), { - content: "assert(spy.calledOnce === true)", - filepath: "test/fixtures/React/fixture.js", - line: 44, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"spy\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"calledOnce\",\"range\":[11,21]},\"computed\":false,\"range\":[7,21]},\"right\":{\"type\":\"BooleanLiteral\",\"value\":true,\"range\":[26,30]},\"range\":[7,30]}],\"range\":[0,31]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"spy\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"calledOnce\",\"range\":[11,21]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[22,25]},{\"type\":{\"label\":\"true\"},\"value\":\"true\",\"range\":[26,30]},{\"type\":{\"label\":\")\"},\"range\":[30,31]}]", - visitorKeys: _powerAssertVisitorKeys - })); - (0, _powerAssert.default)(_rec5._expr(_rec5._capt(_rec5._capt(_rec5._capt(spy, "arguments/0/left/callee/object").calledWith(_rec5._capt(item, "arguments/0/left/arguments/0"), false), "arguments/0/left") === true, "arguments/0"), { - content: "assert(spy.calledWith(item, false) === true)", - filepath: "test/fixtures/React/fixture.js", - line: 45, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"spy\",\"range\":[7,10]},\"property\":{\"type\":\"Identifier\",\"name\":\"calledWith\",\"range\":[11,21]},\"computed\":false,\"range\":[7,21]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"item\",\"range\":[22,26]},{\"type\":\"BooleanLiteral\",\"value\":false,\"range\":[28,33]}],\"range\":[7,34]},\"right\":{\"type\":\"BooleanLiteral\",\"value\":true,\"range\":[39,43]},\"range\":[7,43]}],\"range\":[0,44]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"spy\",\"range\":[7,10]},{\"type\":{\"label\":\".\"},\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"calledWith\",\"range\":[11,21]},{\"type\":{\"label\":\"(\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"item\",\"range\":[22,26]},{\"type\":{\"label\":\",\"},\"range\":[26,27]},{\"type\":{\"label\":\"false\"},\"value\":\"false\",\"range\":[28,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[35,38]},{\"type\":{\"label\":\"true\"},\"value\":\"true\",\"range\":[39,43]},{\"type\":{\"label\":\")\"},\"range\":[43,44]}]", - visitorKeys: _powerAssertVisitorKeys - })); + assert(_ag4._rec(_ag4._tap(_ag4._tap(spy, "arguments/0/left/object").calledOnce, "arguments/0/left") === true, "arguments/0"), new _AssertionMessage(_am4, -1)); + assert(_ag5._rec(_ag5._tap(_ag5._tap(spy, "arguments/0/left/callee/object").calledWith(_ag5._tap(item, "arguments/0/left/arguments/0"), false), "arguments/0/left") === true, "arguments/0"), new _AssertionMessage(_am5, -1)); }); }); describe('<Foo />', function () { describe('#shallow', function () { it('#contains', function () { - var _rec6 = new _powerAssertRecorder(); - - (0, _powerAssert.default)(_rec6._expr(_rec6._capt(_rec6._capt((0, _enzyme.shallow)(_react.default.createElement(_Foo.default, null)), "arguments/0/callee/object").contains(_react.default.createElement("div", { - className: "foo" - })), "arguments/0"), { - content: "assert(shallow(<Foo />).contains(<div className='foo' />))", - filepath: "test/fixtures/React/fixture.js", - line: 52, + var _am6 = _pwmeta(0, "assert(shallow(<Foo />).contains(<div className='foo' />))", "test/fixtures/React/fixture.js", 52, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"Foo\",\"range\":[16,19]},\"attributes\":[],\"selfClosing\":true,\"range\":[15,22]},\"closingElement\":null,\"children\":[],\"range\":[15,22]}],\"range\":[7,23]},\"property\":{\"type\":\"Identifier\",\"name\":\"contains\",\"range\":[24,32]},\"computed\":false,\"range\":[7,32]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"div\",\"range\":[34,37]},\"attributes\":[{\"type\":\"JSXAttribute\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"className\",\"range\":[38,47]},\"value\":{\"type\":\"StringLiteral\",\"value\":\"foo\",\"range\":[48,53]},\"range\":[38,53]}],\"selfClosing\":true,\"range\":[33,56]},\"closingElement\":null,\"children\":[],\"range\":[33,56]}],\"range\":[7,57]}],\"range\":[0,58]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"Foo\",\"range\":[16,19]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[20,21]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]},{\"type\":{\"label\":\".\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"contains\",\"range\":[24,32]},{\"type\":{\"label\":\"(\"},\"range\":[32,33]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[33,34]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"div\",\"range\":[34,37]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"className\",\"range\":[38,47]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[47,48]},{\"type\":{\"label\":\"string\"},\"value\":\"foo\",\"range\":[48,53]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[54,55]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[55,56]},{\"type\":{\"label\":\")\"},\"range\":[56,57]},{\"type\":{\"label\":\")\"},\"range\":[57,58]}]", visitorKeys: _powerAssertVisitorKeys - })); + }), + _ag6 = new _ArgumentRecorder(_powerAssert["default"], _am6, 0); + + assert(_ag6._rec(_ag6._tap((0, _enzyme.shallow)(_react["default"].createElement(_Foo["default"], null)), "arguments/0/callee/object").contains(_react["default"].createElement("div", { + className: "foo" + })), "arguments/0"), new _AssertionMessage(_am6, -1)); }); it('#is', function () { - var _rec7 = new _powerAssertRecorder(); - - (0, _powerAssert.default)(_rec7._expr(_rec7._capt(_rec7._capt((0, _enzyme.shallow)(_react.default.createElement(_Foo.default, null)), "arguments/0/callee/object").is('.foo'), "arguments/0"), { - content: "assert(shallow(<Foo />).is('.foo'))", - filepath: "test/fixtures/React/fixture.js", - line: 55, + var _am7 = _pwmeta(0, "assert(shallow(<Foo />).is('.foo'))", "test/fixtures/React/fixture.js", 55, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"shallow\",\"range\":[7,14]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"Foo\",\"range\":[16,19]},\"attributes\":[],\"selfClosing\":true,\"range\":[15,22]},\"closingElement\":null,\"children\":[],\"range\":[15,22]}],\"range\":[7,23]},\"property\":{\"type\":\"Identifier\",\"name\":\"is\",\"range\":[24,26]},\"computed\":false,\"range\":[7,26]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".foo\",\"range\":[27,33]}],\"range\":[7,34]}],\"range\":[0,35]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"shallow\",\"range\":[7,14]},{\"type\":{\"label\":\"(\"},\"range\":[14,15]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[15,16]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"Foo\",\"range\":[16,19]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[20,21]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]},{\"type\":{\"label\":\".\"},\"range\":[23,24]},{\"type\":{\"label\":\"name\"},\"value\":\"is\",\"range\":[24,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"string\"},\"value\":\".foo\",\"range\":[27,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\")\"},\"range\":[34,35]}]", visitorKeys: _powerAssertVisitorKeys - })); + }), + _ag7 = new _ArgumentRecorder(_powerAssert["default"], _am7, 0); + + assert(_ag7._rec(_ag7._tap((0, _enzyme.shallow)(_react["default"].createElement(_Foo["default"], null)), "arguments/0/callee/object").is('.foo'), "arguments/0"), new _AssertionMessage(_am7, -1)); }); }); describe('#mount', function () { it('#find', function () { - var _rec8 = new _powerAssertRecorder(); - - (0, _powerAssert.default)(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt((0, _enzyme.mount)(_react.default.createElement(_Foo.default, null)), "arguments/0/left/object/callee/object").find('.foo'), "arguments/0/left/object").length, "arguments/0/left") === 1, "arguments/0"), { - content: "assert(mount(<Foo />).find('.foo').length === 1)", - filepath: "test/fixtures/React/fixture.js", - line: 60, + var _am8 = _pwmeta(0, "assert(mount(<Foo />).find('.foo').length === 1)", "test/fixtures/React/fixture.js", 60, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"mount\",\"range\":[7,12]},\"arguments\":[{\"type\":\"JSXElement\",\"openingElement\":{\"type\":\"JSXOpeningElement\",\"name\":{\"type\":\"JSXIdentifier\",\"name\":\"Foo\",\"range\":[14,17]},\"attributes\":[],\"selfClosing\":true,\"range\":[13,20]},\"closingElement\":null,\"children\":[],\"range\":[13,20]}],\"range\":[7,21]},\"property\":{\"type\":\"Identifier\",\"name\":\"find\",\"range\":[22,26]},\"computed\":false,\"range\":[7,26]},\"arguments\":[{\"type\":\"StringLiteral\",\"value\":\".foo\",\"range\":[27,33]}],\"range\":[7,34]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[35,41]},\"computed\":false,\"range\":[7,41]},\"right\":{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[46,47]},\"range\":[7,47]}],\"range\":[0,48]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"mount\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[13,14]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"Foo\",\"range\":[14,17]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[18,19]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[19,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]},{\"type\":{\"label\":\".\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[22,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"string\"},\"value\":\".foo\",\"range\":[27,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\".\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[35,41]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[42,45]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[46,47]},{\"type\":{\"label\":\")\"},\"range\":[47,48]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"mount\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"jsxTagStart\"},\"range\":[13,14]},{\"type\":{\"label\":\"jsxName\"},\"value\":\"Foo\",\"range\":[14,17]},{\"type\":{\"label\":\"/\"},\"value\":\"/\",\"range\":[18,19]},{\"type\":{\"label\":\"jsxTagEnd\"},\"range\":[19,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]},{\"type\":{\"label\":\".\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"find\",\"range\":[22,26]},{\"type\":{\"label\":\"(\"},\"range\":[26,27]},{\"type\":{\"label\":\"string\"},\"value\":\".foo\",\"range\":[27,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\".\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[35,41]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[42,45]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[46,47]},{\"type\":{\"label\":\")\"},\"range\":[47,48]}]", visitorKeys: _powerAssertVisitorKeys - })); + }), + _ag8 = new _ArgumentRecorder(_powerAssert["default"], _am8, 0); + + assert(_ag8._rec(_ag8._tap(_ag8._tap(_ag8._tap((0, _enzyme.mount)(_react["default"].createElement(_Foo["default"], null)), "arguments/0/left/object/callee/object").find('.foo'), "arguments/0/left/object").length, "arguments/0/left") === 1, "arguments/0"), new _AssertionMessage(_am8, -1)); }); }); }); diff --git a/test/fixtures/SequenceExpression/expected-presets-env.js b/test/fixtures/SequenceExpression/expected-presets-env.js index 85b5af6..5b255cf 100644 --- a/test/fixtures/SequenceExpression/expected-presets-env.js +++ b/test/fixtures/SequenceExpression/expected-presets-env.js @@ -1,52 +1,58 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(); - -assert((2, 1, 0)); -assert(_rec2._expr(_rec2._capt((_rec2._capt(foo, "arguments/0/left/expressions/0"), _rec2._capt(bar, "arguments/0/left/expressions/1")) === _rec2._capt(baz, "arguments/0/right"), "arguments/0"), { - content: "assert((foo, bar) === baz)", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 5, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert((2, 1, 0))", "test/fixtures/SequenceExpression/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"NumericLiteral\",\"value\":2,\"range\":[8,9]},{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[11,12]},{\"type\":\"NumericLiteral\",\"value\":0,\"range\":[14,15]}],\"range\":[8,15]}],\"range\":[0,17]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"num\"},\"value\":2,\"range\":[8,9]},{\"type\":{\"label\":\",\"},\"range\":[9,10]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[11,12]},{\"type\":{\"label\":\",\"},\"range\":[12,13]},{\"type\":{\"label\":\"num\"},\"value\":0,\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _am2 = _pwmeta(0, "assert((foo, bar) === baz)", "test/fixtures/SequenceExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[8,11]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[13,16]}],\"range\":[8,16]},\"right\":{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[22,25]},\"range\":[7,25]}],\"range\":[0,26]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[8,11]},{\"type\":{\"label\":\",\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[13,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[18,21]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[22,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[8,11]},{\"type\":{\"label\":\",\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[13,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[18,21]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[22,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(toto((_rec3._capt(tata, "arguments/0/arguments/0/expressions/0"), _rec3._capt(titi, "arguments/0/arguments/0/expressions/1"))), "arguments/0"), { - content: "assert(toto((tata, titi)))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am3 = _pwmeta(0, "assert(toto((tata, titi)))", "test/fixtures/SequenceExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"toto\",\"range\":[7,11]},\"arguments\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"Identifier\",\"name\":\"tata\",\"range\":[13,17]},{\"type\":\"Identifier\",\"name\":\"titi\",\"range\":[19,23]}],\"range\":[13,23]}],\"range\":[7,25]}],\"range\":[0,26]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"toto\",\"range\":[7,11]},{\"type\":{\"label\":\"(\"},\"range\":[11,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"tata\",\"range\":[13,17]},{\"type\":{\"label\":\",\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"titi\",\"range\":[19,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]},{\"type\":{\"label\":\")\"},\"range\":[25,26]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr((_rec4._capt(foo, "arguments/0/expressions/0"), (_rec4._capt(bar, "arguments/0/expressions/1/expressions/0"), _rec4._capt(baz, "arguments/0/expressions/1/expressions/1"))), { - content: "assert((foo, (bar, baz)))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert((foo, (bar, baz)))", "test/fixtures/SequenceExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[8,11]},{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[14,17]},{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[19,22]}],\"range\":[14,22]}],\"range\":[8,23]}],\"range\":[0,25]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[8,11]},{\"type\":{\"label\":\",\"},\"range\":[11,12]},{\"type\":{\"label\":\"(\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[14,17]},{\"type\":{\"label\":\",\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[19,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\")\"},\"range\":[24,25]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr((((((_rec5._capt(foo, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/0"), _rec5._capt(bar, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(baz, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(toto, "arguments/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(tata, "arguments/0/expressions/0/expressions/1")), _rec5._capt(titi, "arguments/0/expressions/1")), { - content: "assert((((((foo, bar), baz), toto), tata), titi))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert((((((foo, bar), baz), toto), tata), titi))", "test/fixtures/SequenceExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[12,15]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[17,20]}],\"range\":[12,20]},{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[23,26]}],\"range\":[11,26]},{\"type\":\"Identifier\",\"name\":\"toto\",\"range\":[29,33]}],\"range\":[10,33]},{\"type\":\"Identifier\",\"name\":\"tata\",\"range\":[36,40]}],\"range\":[9,40]},{\"type\":\"Identifier\",\"name\":\"titi\",\"range\":[43,47]}],\"range\":[8,47]}],\"range\":[0,49]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"(\"},\"range\":[8,9]},{\"type\":{\"label\":\"(\"},\"range\":[9,10]},{\"type\":{\"label\":\"(\"},\"range\":[10,11]},{\"type\":{\"label\":\"(\"},\"range\":[11,12]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[12,15]},{\"type\":{\"label\":\",\"},\"range\":[15,16]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[17,20]},{\"type\":{\"label\":\")\"},\"range\":[20,21]},{\"type\":{\"label\":\",\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[23,26]},{\"type\":{\"label\":\")\"},\"range\":[26,27]},{\"type\":{\"label\":\",\"},\"range\":[27,28]},{\"type\":{\"label\":\"name\"},\"value\":\"toto\",\"range\":[29,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]},{\"type\":{\"label\":\",\"},\"range\":[34,35]},{\"type\":{\"label\":\"name\"},\"value\":\"tata\",\"range\":[36,40]},{\"type\":{\"label\":\")\"},\"range\":[40,41]},{\"type\":{\"label\":\",\"},\"range\":[41,42]},{\"type\":{\"label\":\"name\"},\"value\":\"titi\",\"range\":[43,47]},{\"type\":{\"label\":\")\"},\"range\":[47,48]},{\"type\":{\"label\":\")\"},\"range\":[48,49]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr((_rec6._capt(y = _rec6._capt(x, "arguments/0/expressions/0/right"), "arguments/0/expressions/0"), _rec6._capt(z, "arguments/0/expressions/1")), { - content: "assert((y = x, z))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 13, +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert((y = x, z))", "test/fixtures/SequenceExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"SequenceExpression\",\"expressions\":[{\"type\":\"AssignmentExpression\",\"operator\":\"=\",\"left\":{\"type\":\"Identifier\",\"name\":\"y\",\"range\":[8,9]},\"right\":{\"type\":\"Identifier\",\"name\":\"x\",\"range\":[12,13]},\"range\":[8,13]},{\"type\":\"Identifier\",\"name\":\"z\",\"range\":[15,16]}],\"range\":[8,16]}],\"range\":[0,18]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"y\",\"range\":[8,9]},{\"type\":{\"label\":\"=\"},\"value\":\"=\",\"range\":[10,11]},{\"type\":{\"label\":\"name\"},\"value\":\"x\",\"range\":[12,13]},{\"type\":{\"label\":\",\"},\"range\":[13,14]},{\"type\":{\"label\":\"name\"},\"value\":\"z\",\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]},{\"type\":{\"label\":\")\"},\"range\":[17,18]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag6 = new _ArgumentRecorder(assert, _am6, 0); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert((2, 1, 0)); +assert(_ag2._rec((_ag2._tap(foo, "arguments/0/left/expressions/0"), _ag2._tap(bar, "arguments/0/left/expressions/1")) === _ag2._tap(baz, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(toto((_ag3._tap(tata, "arguments/0/arguments/0/expressions/0"), _ag3._tap(titi, "arguments/0/arguments/0/expressions/1"))), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec((_ag4._tap(foo, "arguments/0/expressions/0"), (_ag4._tap(bar, "arguments/0/expressions/1/expressions/0"), _ag4._tap(baz, "arguments/0/expressions/1/expressions/1")))), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec((((((_ag5._tap(foo, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/0"), _ag5._tap(bar, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(baz, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(toto, "arguments/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(tata, "arguments/0/expressions/0/expressions/1")), _ag5._tap(titi, "arguments/0/expressions/1"))), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec((_ag6._tap(y = _ag6._tap(x, "arguments/0/expressions/0/right"), "arguments/0/expressions/0"), _ag6._tap(z, "arguments/0/expressions/1"))), new _AssertionMessage(_am6, -1)); diff --git a/test/fixtures/SequenceExpression/expected.js b/test/fixtures/SequenceExpression/expected.js index 9b74e7f..134d878 100644 --- a/test/fixtures/SequenceExpression/expected.js +++ b/test/fixtures/SequenceExpression/expected.js @@ -1,36 +1,25 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert((2, 1, 0))", "test/fixtures/SequenceExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _am2 = _pwmeta(0, "assert((foo, bar) === baz)", "test/fixtures/SequenceExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am3 = _pwmeta(0, "assert(toto((tata, titi)))", "test/fixtures/SequenceExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert((foo, (bar, baz)))", "test/fixtures/SequenceExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert((((((foo, bar), baz), toto), tata), titi))", "test/fixtures/SequenceExpression/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert((y = x, z))", "test/fixtures/SequenceExpression/fixture.js", 13), + _ag6 = new _ArgumentRecorder(assert, _am6, 0); assert((2, 1, 0)); -assert(_rec2._expr(_rec2._capt((_rec2._capt(foo, "arguments/0/left/expressions/0"), _rec2._capt(bar, "arguments/0/left/expressions/1")) === _rec2._capt(baz, "arguments/0/right"), "arguments/0"), { - content: "assert((foo, bar) === baz)", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(toto((_rec3._capt(tata, "arguments/0/arguments/0/expressions/0"), _rec3._capt(titi, "arguments/0/arguments/0/expressions/1"))), "arguments/0"), { - content: "assert(toto((tata, titi)))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr((_rec4._capt(foo, "arguments/0/expressions/0"), (_rec4._capt(bar, "arguments/0/expressions/1/expressions/0"), _rec4._capt(baz, "arguments/0/expressions/1/expressions/1"))), { - content: "assert((foo, (bar, baz)))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 9 -})); -assert(_rec5._expr((((((_rec5._capt(foo, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/0"), _rec5._capt(bar, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(baz, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(toto, "arguments/0/expressions/0/expressions/0/expressions/1")), _rec5._capt(tata, "arguments/0/expressions/0/expressions/1")), _rec5._capt(titi, "arguments/0/expressions/1")), { - content: "assert((((((foo, bar), baz), toto), tata), titi))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 11 -})); -assert(_rec6._expr((_rec6._capt(y = _rec6._capt(x, "arguments/0/expressions/0/right"), "arguments/0/expressions/0"), _rec6._capt(z, "arguments/0/expressions/1")), { - content: "assert((y = x, z))", - filepath: "test/fixtures/SequenceExpression/fixture.js", - line: 13 -})); +assert(_ag2._rec((_ag2._tap(foo, "arguments/0/left/expressions/0"), _ag2._tap(bar, "arguments/0/left/expressions/1")) === _ag2._tap(baz, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(toto((_ag3._tap(tata, "arguments/0/arguments/0/expressions/0"), _ag3._tap(titi, "arguments/0/arguments/0/expressions/1"))), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec((_ag4._tap(foo, "arguments/0/expressions/0"), (_ag4._tap(bar, "arguments/0/expressions/1/expressions/0"), _ag4._tap(baz, "arguments/0/expressions/1/expressions/1")))), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec((((((_ag5._tap(foo, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/0"), _ag5._tap(bar, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(baz, "arguments/0/expressions/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(toto, "arguments/0/expressions/0/expressions/0/expressions/1")), _ag5._tap(tata, "arguments/0/expressions/0/expressions/1")), _ag5._tap(titi, "arguments/0/expressions/1"))), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec((_ag6._tap(y = _ag6._tap(x, "arguments/0/expressions/0/right"), "arguments/0/expressions/0"), _ag6._tap(z, "arguments/0/expressions/1"))), new _AssertionMessage(_am6, -1)); diff --git a/test/fixtures/SpreadElement/expected-presets-env.js b/test/fixtures/SpreadElement/expected-presets-env.js index 027ddb8..5eccd1c 100644 --- a/test/fixtures/SpreadElement/expected-presets-env.js +++ b/test/fixtures/SpreadElement/expected-presets-env.js @@ -1,42 +1,47 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -assert(_rec._expr(_rec._capt(hello.apply(void 0, _toConsumableArray(_rec._capt(names, "arguments/0/arguments/0/argument"))), "arguments/0"), { - content: "assert(hello(...names))", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(hello(...names))", "test/fixtures/SpreadElement/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"hello\",\"range\":[7,12]},\"arguments\":[{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"Identifier\",\"name\":\"names\",\"range\":[16,21]},\"range\":[13,21]}],\"range\":[7,22]}],\"range\":[0,23]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"hello\",\"range\":[7,12]},{\"type\":{\"label\":\"(\"},\"range\":[12,13]},{\"type\":{\"label\":\"...\"},\"range\":[13,16]},{\"type\":{\"label\":\"name\"},\"value\":\"names\",\"range\":[16,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt([_rec2._capt(head, "arguments/0/object/elements/0")].concat(_toConsumableArray(_rec2._capt(tail, "arguments/0/object/elements/1/argument"))), "arguments/0/object").length, "arguments/0"), { - content: "assert([head, ...tail].length)", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert([head, ...tail].length)", "test/fixtures/SpreadElement/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"head\",\"range\":[8,12]},{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"Identifier\",\"name\":\"tail\",\"range\":[17,21]},\"range\":[14,21]}],\"range\":[7,22]},\"property\":{\"type\":\"Identifier\",\"name\":\"length\",\"range\":[23,29]},\"computed\":false,\"range\":[7,29]}],\"range\":[0,30]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"[\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"head\",\"range\":[8,12]},{\"type\":{\"label\":\",\"},\"range\":[12,13]},{\"type\":{\"label\":\"...\"},\"range\":[14,17]},{\"type\":{\"label\":\"name\"},\"value\":\"tail\",\"range\":[17,21]},{\"type\":{\"label\":\"]\"},\"range\":[21,22]},{\"type\":{\"label\":\".\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"length\",\"range\":[23,29]},{\"type\":{\"label\":\")\"},\"range\":[29,30]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(f.apply(void 0, [_rec3._capt(head, "arguments/0/arguments/0")].concat(_toConsumableArray(_rec3._capt(iter(), "arguments/0/arguments/1/argument")), _toConsumableArray(_rec3._capt([_rec3._capt(foo, "arguments/0/arguments/2/argument/elements/0"), _rec3._capt(bar, "arguments/0/arguments/2/argument/elements/1")], "arguments/0/arguments/2/argument")))), "arguments/0"), { - content: "assert(f(head, ...iter(), ...[foo, bar]))", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(f(head, ...iter(), ...[foo, bar]))", "test/fixtures/SpreadElement/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"f\",\"range\":[7,8]},\"arguments\":[{\"type\":\"Identifier\",\"name\":\"head\",\"range\":[9,13]},{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"iter\",\"range\":[18,22]},\"arguments\":[],\"range\":[18,24]},\"range\":[15,24]},{\"type\":\"SpreadElement\",\"argument\":{\"type\":\"ArrayExpression\",\"elements\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[30,33]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[35,38]}],\"range\":[29,39]},\"range\":[26,39]}],\"range\":[7,40]}],\"range\":[0,41]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"f\",\"range\":[7,8]},{\"type\":{\"label\":\"(\"},\"range\":[8,9]},{\"type\":{\"label\":\"name\"},\"value\":\"head\",\"range\":[9,13]},{\"type\":{\"label\":\",\"},\"range\":[13,14]},{\"type\":{\"label\":\"...\"},\"range\":[15,18]},{\"type\":{\"label\":\"name\"},\"value\":\"iter\",\"range\":[18,22]},{\"type\":{\"label\":\"(\"},\"range\":[22,23]},{\"type\":{\"label\":\")\"},\"range\":[23,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"...\"},\"range\":[26,29]},{\"type\":{\"label\":\"[\"},\"range\":[29,30]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[30,33]},{\"type\":{\"label\":\",\"},\"range\":[33,34]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[35,38]},{\"type\":{\"label\":\"]\"},\"range\":[38,39]},{\"type\":{\"label\":\")\"},\"range\":[39,40]},{\"type\":{\"label\":\")\"},\"range\":[40,41]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(hello.apply(void 0, _toConsumableArray(_ag._tap(names, "arguments/0/arguments/0/argument"))), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap([_ag2._tap(head, "arguments/0/object/elements/0")].concat(_toConsumableArray(_ag2._tap(tail, "arguments/0/object/elements/1/argument"))), "arguments/0/object").length, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(f.apply(void 0, [_ag3._tap(head, "arguments/0/arguments/0")].concat(_toConsumableArray(_ag3._tap(iter(), "arguments/0/arguments/1/argument")), _toConsumableArray(_ag3._tap([_ag3._tap(foo, "arguments/0/arguments/2/argument/elements/0"), _ag3._tap(bar, "arguments/0/arguments/2/argument/elements/1")], "arguments/0/arguments/2/argument")))), "arguments/0"), new _AssertionMessage(_am3, -1)); assert.apply(void 0, _toConsumableArray(iter())); assert.apply(void 0, [foo, bar]); diff --git a/test/fixtures/SpreadElement/expected.js b/test/fixtures/SpreadElement/expected.js index bf1bd32..cb33edc 100644 --- a/test/fixtures/SpreadElement/expected.js +++ b/test/fixtures/SpreadElement/expected.js @@ -1,24 +1,18 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(hello(...names))", "test/fixtures/SpreadElement/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert([head, ...tail].length)", "test/fixtures/SpreadElement/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(f(head, ...iter(), ...[foo, bar]))", "test/fixtures/SpreadElement/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); -assert(_rec._expr(_rec._capt(hello(..._rec._capt(names, "arguments/0/arguments/0/argument")), "arguments/0"), { - content: "assert(hello(...names))", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(_rec2._capt([_rec2._capt(head, "arguments/0/object/elements/0"), ..._rec2._capt(tail, "arguments/0/object/elements/1/argument")], "arguments/0/object").length, "arguments/0"), { - content: "assert([head, ...tail].length)", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(f(_rec3._capt(head, "arguments/0/arguments/0"), ..._rec3._capt(iter(), "arguments/0/arguments/1/argument"), ..._rec3._capt([_rec3._capt(foo, "arguments/0/arguments/2/argument/elements/0"), _rec3._capt(bar, "arguments/0/arguments/2/argument/elements/1")], "arguments/0/arguments/2/argument")), "arguments/0"), { - content: "assert(f(head, ...iter(), ...[foo, bar]))", - filepath: "test/fixtures/SpreadElement/fixture.js", - line: 7 -})); +assert(_ag._rec(hello(..._ag._tap(names, "arguments/0/arguments/0/argument")), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(_ag2._tap([_ag2._tap(head, "arguments/0/object/elements/0"), ..._ag2._tap(tail, "arguments/0/object/elements/1/argument")], "arguments/0/object").length, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(f(_ag3._tap(head, "arguments/0/arguments/0"), ..._ag3._tap(iter(), "arguments/0/arguments/1/argument"), ..._ag3._tap([_ag3._tap(foo, "arguments/0/arguments/2/argument/elements/0"), _ag3._tap(bar, "arguments/0/arguments/2/argument/elements/1")], "arguments/0/arguments/2/argument")), "arguments/0"), new _AssertionMessage(_am3, -1)); assert(...iter()); assert(...[foo, bar]); diff --git a/test/fixtures/TaggedTemplateExpression/expected-presets-env.js b/test/fixtures/TaggedTemplateExpression/expected-presets-env.js index 69cf4c5..918df98 100644 --- a/test/fixtures/TaggedTemplateExpression/expected-presets-env.js +++ b/test/fixtures/TaggedTemplateExpression/expected-presets-env.js @@ -1,10 +1,28 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(fn`a${1}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 3, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"a\",\"cooked\":\"a\"},\"tail\":false,\"range\":[10,11]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[15,15]}],\"expressions\":[{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[13,14]}],\"range\":[9,16]},\"range\":[7,16]}],\"range\":[0,17]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"a\",\"range\":[10,11]},{\"type\":{\"label\":\"${\"},\"range\":[11,13]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[13,14]},{\"type\":{\"label\":\"}\"},\"range\":[14,15]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[15,15]},{\"type\":{\"label\":\"`\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(fn`a${foo}b${bar}c${baz}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 5, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"a\",\"cooked\":\"a\"},\"tail\":false,\"range\":[10,11]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"b\",\"cooked\":\"b\"},\"tail\":false,\"range\":[17,18]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"c\",\"cooked\":\"c\"},\"tail\":false,\"range\":[24,25]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[31,31]}],\"expressions\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[20,23]},{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[27,30]}],\"range\":[9,32]},\"range\":[7,32]}],\"range\":[0,33]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"a\",\"range\":[10,11]},{\"type\":{\"label\":\"${\"},\"range\":[11,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[13,16]},{\"type\":{\"label\":\"}\"},\"range\":[16,17]},{\"type\":{\"label\":\"template\"},\"value\":\"b\",\"range\":[17,18]},{\"type\":{\"label\":\"${\"},\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[20,23]},{\"type\":{\"label\":\"}\"},\"range\":[23,24]},{\"type\":{\"label\":\"template\"},\"value\":\"c\",\"range\":[24,25]},{\"type\":{\"label\":\"${\"},\"range\":[25,27]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[27,30]},{\"type\":{\"label\":\"}\"},\"range\":[30,31]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[31,31]},{\"type\":{\"label\":\"`\"},\"range\":[31,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(fn`driver ${bob.name}, navigator ${alice.getName()}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 7, { + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"driver \",\"cooked\":\"driver \"},\"tail\":false,\"range\":[10,17]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\", navigator \",\"cooked\":\", navigator \"},\"tail\":false,\"range\":[28,40]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[58,58]}],\"expressions\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"bob\",\"range\":[19,22]},\"property\":{\"type\":\"Identifier\",\"name\":\"name\",\"range\":[23,27]},\"computed\":false,\"range\":[19,27]},{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"alice\",\"range\":[42,47]},\"property\":{\"type\":\"Identifier\",\"name\":\"getName\",\"range\":[48,55]},\"computed\":false,\"range\":[42,55]},\"arguments\":[],\"range\":[42,57]}],\"range\":[9,59]},\"range\":[7,59]}],\"range\":[0,60]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"driver \",\"range\":[10,17]},{\"type\":{\"label\":\"${\"},\"range\":[17,19]},{\"type\":{\"label\":\"name\"},\"value\":\"bob\",\"range\":[19,22]},{\"type\":{\"label\":\".\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"name\",\"range\":[23,27]},{\"type\":{\"label\":\"}\"},\"range\":[27,28]},{\"type\":{\"label\":\"template\"},\"value\":\", navigator \",\"range\":[28,40]},{\"type\":{\"label\":\"${\"},\"range\":[40,42]},{\"type\":{\"label\":\"name\"},\"value\":\"alice\",\"range\":[42,47]},{\"type\":{\"label\":\".\"},\"range\":[47,48]},{\"type\":{\"label\":\"name\"},\"value\":\"getName\",\"range\":[48,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\")\"},\"range\":[56,57]},{\"type\":{\"label\":\"}\"},\"range\":[57,58]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[58,58]},{\"type\":{\"label\":\"`\"},\"range\":[58,59]},{\"type\":{\"label\":\")\"},\"range\":[59,60]}]", + visitorKeys: _powerAssertVisitorKeys +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); function _templateObject3() { var data = _taggedTemplateLiteral(["driver ", ", navigator ", ""]); @@ -38,27 +56,14 @@ function _templateObject() { function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } -assert(_rec._expr(_rec._capt(fn(_templateObject(), 1), "arguments/0"), { - content: "assert(fn`a${1}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 3, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"a\",\"cooked\":\"a\"},\"tail\":false,\"range\":[10,11]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[15,15]}],\"expressions\":[{\"type\":\"NumericLiteral\",\"value\":1,\"range\":[13,14]}],\"range\":[9,16]},\"range\":[7,16]}],\"range\":[0,17]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"a\",\"range\":[10,11]},{\"type\":{\"label\":\"${\"},\"range\":[11,13]},{\"type\":{\"label\":\"num\"},\"value\":1,\"range\":[13,14]},{\"type\":{\"label\":\"}\"},\"range\":[14,15]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[15,15]},{\"type\":{\"label\":\"`\"},\"range\":[15,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(fn(_templateObject2(), _rec2._capt(foo, "arguments/0/quasi/expressions/0"), _rec2._capt(bar, "arguments/0/quasi/expressions/1"), _rec2._capt(baz, "arguments/0/quasi/expressions/2")), "arguments/0"), { - content: "assert(fn`a${foo}b${bar}c${baz}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 5, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"a\",\"cooked\":\"a\"},\"tail\":false,\"range\":[10,11]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"b\",\"cooked\":\"b\"},\"tail\":false,\"range\":[17,18]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"c\",\"cooked\":\"c\"},\"tail\":false,\"range\":[24,25]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[31,31]}],\"expressions\":[{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[13,16]},{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[20,23]},{\"type\":\"Identifier\",\"name\":\"baz\",\"range\":[27,30]}],\"range\":[9,32]},\"range\":[7,32]}],\"range\":[0,33]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"a\",\"range\":[10,11]},{\"type\":{\"label\":\"${\"},\"range\":[11,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[13,16]},{\"type\":{\"label\":\"}\"},\"range\":[16,17]},{\"type\":{\"label\":\"template\"},\"value\":\"b\",\"range\":[17,18]},{\"type\":{\"label\":\"${\"},\"range\":[18,20]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[20,23]},{\"type\":{\"label\":\"}\"},\"range\":[23,24]},{\"type\":{\"label\":\"template\"},\"value\":\"c\",\"range\":[24,25]},{\"type\":{\"label\":\"${\"},\"range\":[25,27]},{\"type\":{\"label\":\"name\"},\"value\":\"baz\",\"range\":[27,30]},{\"type\":{\"label\":\"}\"},\"range\":[30,31]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[31,31]},{\"type\":{\"label\":\"`\"},\"range\":[31,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(fn(_templateObject3(), _rec3._capt(_rec3._capt(bob, "arguments/0/quasi/expressions/0/object").name, "arguments/0/quasi/expressions/0"), _rec3._capt(_rec3._capt(alice, "arguments/0/quasi/expressions/1/callee/object").getName(), "arguments/0/quasi/expressions/1")), "arguments/0"), { - content: "assert(fn`driver ${bob.name}, navigator ${alice.getName()}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 7, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TaggedTemplateExpression\",\"tag\":{\"type\":\"Identifier\",\"name\":\"fn\",\"range\":[7,9]},\"quasi\":{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"driver \",\"cooked\":\"driver \"},\"tail\":false,\"range\":[10,17]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\", navigator \",\"cooked\":\", navigator \"},\"tail\":false,\"range\":[28,40]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[58,58]}],\"expressions\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"bob\",\"range\":[19,22]},\"property\":{\"type\":\"Identifier\",\"name\":\"name\",\"range\":[23,27]},\"computed\":false,\"range\":[19,27]},{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"alice\",\"range\":[42,47]},\"property\":{\"type\":\"Identifier\",\"name\":\"getName\",\"range\":[48,55]},\"computed\":false,\"range\":[42,55]},\"arguments\":[],\"range\":[42,57]}],\"range\":[9,59]},\"range\":[7,59]}],\"range\":[0,60]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"fn\",\"range\":[7,9]},{\"type\":{\"label\":\"`\"},\"range\":[9,10]},{\"type\":{\"label\":\"template\"},\"value\":\"driver \",\"range\":[10,17]},{\"type\":{\"label\":\"${\"},\"range\":[17,19]},{\"type\":{\"label\":\"name\"},\"value\":\"bob\",\"range\":[19,22]},{\"type\":{\"label\":\".\"},\"range\":[22,23]},{\"type\":{\"label\":\"name\"},\"value\":\"name\",\"range\":[23,27]},{\"type\":{\"label\":\"}\"},\"range\":[27,28]},{\"type\":{\"label\":\"template\"},\"value\":\", navigator \",\"range\":[28,40]},{\"type\":{\"label\":\"${\"},\"range\":[40,42]},{\"type\":{\"label\":\"name\"},\"value\":\"alice\",\"range\":[42,47]},{\"type\":{\"label\":\".\"},\"range\":[47,48]},{\"type\":{\"label\":\"name\"},\"value\":\"getName\",\"range\":[48,55]},{\"type\":{\"label\":\"(\"},\"range\":[55,56]},{\"type\":{\"label\":\")\"},\"range\":[56,57]},{\"type\":{\"label\":\"}\"},\"range\":[57,58]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[58,58]},{\"type\":{\"label\":\"`\"},\"range\":[58,59]},{\"type\":{\"label\":\")\"},\"range\":[59,60]}]", - visitorKeys: _powerAssertVisitorKeys -})); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(fn(_templateObject(), 1), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(fn(_templateObject2(), _ag2._tap(foo, "arguments/0/quasi/expressions/0"), _ag2._tap(bar, "arguments/0/quasi/expressions/1"), _ag2._tap(baz, "arguments/0/quasi/expressions/2")), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(fn(_templateObject3(), _ag3._tap(_ag3._tap(bob, "arguments/0/quasi/expressions/0/object").name, "arguments/0/quasi/expressions/0"), _ag3._tap(_ag3._tap(alice, "arguments/0/quasi/expressions/1/callee/object").getName(), "arguments/0/quasi/expressions/1")), "arguments/0"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/TaggedTemplateExpression/expected.js b/test/fixtures/TaggedTemplateExpression/expected.js index 1b0bfa9..e2cc0e1 100644 --- a/test/fixtures/TaggedTemplateExpression/expected.js +++ b/test/fixtures/TaggedTemplateExpression/expected.js @@ -1,22 +1,16 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(fn`a${1}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(fn`a${foo}b${bar}c${baz}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(fn`driver ${bob.name}, navigator ${alice.getName()}`)", "test/fixtures/TaggedTemplateExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); -assert(_rec._expr(_rec._capt(fn`a${1}`, "arguments/0"), { - content: "assert(fn`a${1}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(fn`a${_rec2._capt(foo, "arguments/0/quasi/expressions/0")}b${_rec2._capt(bar, "arguments/0/quasi/expressions/1")}c${_rec2._capt(baz, "arguments/0/quasi/expressions/2")}`, "arguments/0"), { - content: "assert(fn`a${foo}b${bar}c${baz}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(fn`driver ${_rec3._capt(_rec3._capt(bob, "arguments/0/quasi/expressions/0/object").name, "arguments/0/quasi/expressions/0")}, navigator ${_rec3._capt(_rec3._capt(alice, "arguments/0/quasi/expressions/1/callee/object").getName(), "arguments/0/quasi/expressions/1")}`, "arguments/0"), { - content: "assert(fn`driver ${bob.name}, navigator ${alice.getName()}`)", - filepath: "test/fixtures/TaggedTemplateExpression/fixture.js", - line: 7 -})); +assert(_ag._rec(fn`a${1}`, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(fn`a${_ag2._tap(foo, "arguments/0/quasi/expressions/0")}b${_ag2._tap(bar, "arguments/0/quasi/expressions/1")}c${_ag2._tap(baz, "arguments/0/quasi/expressions/2")}`, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(fn`driver ${_ag3._tap(_ag3._tap(bob, "arguments/0/quasi/expressions/0/object").name, "arguments/0/quasi/expressions/0")}, navigator ${_ag3._tap(_ag3._tap(alice, "arguments/0/quasi/expressions/1/callee/object").getName(), "arguments/0/quasi/expressions/1")}`, "arguments/0"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/TemplateLiteral/expected-presets-env.js b/test/fixtures/TemplateLiteral/expected-presets-env.js index 60e0dd5..519ccf9 100644 --- a/test/fixtures/TemplateLiteral/expected-presets-env.js +++ b/test/fixtures/TemplateLiteral/expected-presets-env.js @@ -1,32 +1,37 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt("Hello", "arguments/0"), { - content: "assert(`Hello`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(`Hello`)", "test/fixtures/TemplateLiteral/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"Hello\",\"cooked\":\"Hello\"},\"tail\":true,\"range\":[8,13]}],\"expressions\":[],\"range\":[7,14]}],\"range\":[0,15]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"`\"},\"range\":[7,8]},{\"type\":{\"label\":\"template\"},\"value\":\"Hello\",\"range\":[8,13]},{\"type\":{\"label\":\"`\"},\"range\":[13,14]},{\"type\":{\"label\":\")\"},\"range\":[14,15]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt("Hello, ".concat(_rec2._capt(nickname, "arguments/0/expressions/0")), "arguments/0"), { - content: "assert(`Hello, ${nickname}`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(`Hello, ${nickname}`)", "test/fixtures/TemplateLiteral/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"Hello, \",\"cooked\":\"Hello, \"},\"tail\":false,\"range\":[8,15]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[26,26]}],\"expressions\":[{\"type\":\"Identifier\",\"name\":\"nickname\",\"range\":[17,25]}],\"range\":[7,27]}],\"range\":[0,28]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"`\"},\"range\":[7,8]},{\"type\":{\"label\":\"template\"},\"value\":\"Hello, \",\"range\":[8,15]},{\"type\":{\"label\":\"${\"},\"range\":[15,17]},{\"type\":{\"label\":\"name\"},\"value\":\"nickname\",\"range\":[17,25]},{\"type\":{\"label\":\"}\"},\"range\":[25,26]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[26,26]},{\"type\":{\"label\":\"`\"},\"range\":[26,27]},{\"type\":{\"label\":\")\"},\"range\":[27,28]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt("Hello, ".concat(_rec3._capt(_rec3._capt(user, "arguments/0/expressions/0/object").nickname, "arguments/0/expressions/0")), "arguments/0"), { - content: "assert(`Hello, ${user.nickname}`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(`Hello, ${user.nickname}`)", "test/fixtures/TemplateLiteral/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"TemplateLiteral\",\"quasis\":[{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"Hello, \",\"cooked\":\"Hello, \"},\"tail\":false,\"range\":[8,15]},{\"type\":\"TemplateElement\",\"value\":{\"raw\":\"\",\"cooked\":\"\"},\"tail\":true,\"range\":[31,31]}],\"expressions\":[{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"user\",\"range\":[17,21]},\"property\":{\"type\":\"Identifier\",\"name\":\"nickname\",\"range\":[22,30]},\"computed\":false,\"range\":[17,30]}],\"range\":[7,32]}],\"range\":[0,33]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"`\"},\"range\":[7,8]},{\"type\":{\"label\":\"template\"},\"value\":\"Hello, \",\"range\":[8,15]},{\"type\":{\"label\":\"${\"},\"range\":[15,17]},{\"type\":{\"label\":\"name\"},\"value\":\"user\",\"range\":[17,21]},{\"type\":{\"label\":\".\"},\"range\":[21,22]},{\"type\":{\"label\":\"name\"},\"value\":\"nickname\",\"range\":[22,30]},{\"type\":{\"label\":\"}\"},\"range\":[30,31]},{\"type\":{\"label\":\"template\"},\"value\":\"\",\"range\":[31,31]},{\"type\":{\"label\":\"`\"},\"range\":[31,32]},{\"type\":{\"label\":\")\"},\"range\":[32,33]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec("Hello", "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec("Hello, ".concat(_ag2._tap(nickname, "arguments/0/expressions/0")), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec("Hello, ".concat(_ag3._tap(_ag3._tap(user, "arguments/0/expressions/0/object").nickname, "arguments/0/expressions/0")), "arguments/0"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/TemplateLiteral/expected.js b/test/fixtures/TemplateLiteral/expected.js index 1f46a35..9051320 100644 --- a/test/fixtures/TemplateLiteral/expected.js +++ b/test/fixtures/TemplateLiteral/expected.js @@ -1,22 +1,16 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(`Hello`)", "test/fixtures/TemplateLiteral/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(`Hello, ${nickname}`)", "test/fixtures/TemplateLiteral/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(`Hello, ${user.nickname}`)", "test/fixtures/TemplateLiteral/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0); -assert(_rec._expr(_rec._capt(`Hello`, "arguments/0"), { - content: "assert(`Hello`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(`Hello, ${_rec2._capt(nickname, "arguments/0/expressions/0")}`, "arguments/0"), { - content: "assert(`Hello, ${nickname}`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(`Hello, ${_rec3._capt(_rec3._capt(user, "arguments/0/expressions/0/object").nickname, "arguments/0/expressions/0")}`, "arguments/0"), { - content: "assert(`Hello, ${user.nickname}`)", - filepath: "test/fixtures/TemplateLiteral/fixture.js", - line: 7 -})); +assert(_ag._rec(`Hello`, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(`Hello, ${_ag2._tap(nickname, "arguments/0/expressions/0")}`, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(`Hello, ${_ag3._tap(_ag3._tap(user, "arguments/0/expressions/0/object").nickname, "arguments/0/expressions/0")}`, "arguments/0"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/UnaryExpression/expected-presets-env.js b/test/fixtures/UnaryExpression/expected-presets-env.js index ebe3b25..b50a733 100644 --- a/test/fixtures/UnaryExpression/expected-presets-env.js +++ b/test/fixtures/UnaryExpression/expected-presets-env.js @@ -1,78 +1,66 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(); - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -assert(_rec._expr(_rec._capt(!_rec._capt(truth, "arguments/0/argument"), "arguments/0"), { - content: "assert(!truth)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(!truth)", "test/fixtures/UnaryExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"Identifier\",\"name\":\"truth\",\"range\":[8,13]},\"prefix\":true,\"range\":[7,13]}],\"range\":[0,14]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"truth\",\"range\":[8,13]},{\"type\":{\"label\":\")\"},\"range\":[13,14]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(!_rec2._capt(!_rec2._capt(some, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), { - content: "assert(!!some)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(!!some)", "test/fixtures/UnaryExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"Identifier\",\"name\":\"some\",\"range\":[9,13]},\"prefix\":true,\"range\":[8,13]},\"prefix\":true,\"range\":[7,13]}],\"range\":[0,14]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[8,9]},{\"type\":{\"label\":\"name\"},\"value\":\"some\",\"range\":[9,13]},{\"type\":{\"label\":\")\"},\"range\":[13,14]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec3._expr(_rec3._capt(!_rec3._capt(!_rec3._capt(_rec3._capt(foo, "arguments/0/argument/argument/object").bar, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), { - content: "assert(!!foo.bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(!!foo.bar)", "test/fixtures/UnaryExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"UnaryExpression\",\"operator\":\"!\",\"argument\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[13,16]},\"computed\":false,\"range\":[9,16]},\"prefix\":true,\"range\":[8,16]},\"prefix\":true,\"range\":[7,16]}],\"range\":[0,17]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[7,8]},{\"type\":{\"label\":\"!\"},\"value\":\"!\",\"range\":[8,9]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[9,12]},{\"type\":{\"label\":\".\"},\"range\":[12,13]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[13,16]},{\"type\":{\"label\":\")\"},\"range\":[16,17]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec4._expr(_rec4._capt(delete _rec4._capt(_rec4._capt(foo, "arguments/0/argument/object").bar, "arguments/0/argument"), "arguments/0"), { - content: "assert(delete foo.bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 9, +}), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(delete foo.bar)", "test/fixtures/UnaryExpression/fixture.js", 9, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"delete\",\"argument\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[14,17]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[18,21]},\"computed\":false,\"range\":[14,21]},\"prefix\":true,\"range\":[7,21]}],\"range\":[0,22]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"delete\"},\"value\":\"delete\",\"range\":[7,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\".\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[18,21]},{\"type\":{\"label\":\")\"},\"range\":[21,22]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(typeof foo === "undefined" ? "undefined" : _typeof(foo), "arguments/0/left") !== 'undefined', "arguments/0"), { - content: "assert(typeof foo !== 'undefined')", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 11, +}), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(typeof foo !== 'undefined')", "test/fixtures/UnaryExpression/fixture.js", 11, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[14,17]},\"prefix\":true,\"range\":[7,17]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"undefined\",\"range\":[22,33]},\"range\":[7,33]}],\"range\":[0,34]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[18,21]},{\"type\":{\"label\":\"string\"},\"value\":\"undefined\",\"range\":[22,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[18,21]},{\"type\":{\"label\":\"string\"},\"value\":\"undefined\",\"range\":[22,33]},{\"type\":{\"label\":\")\"},\"range\":[33,34]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(_typeof(_rec6._capt(_rec6._capt(foo, "arguments/0/left/argument/object").bar, "arguments/0/left/argument")), "arguments/0/left") !== 'undefined', "arguments/0"), { - content: "assert(typeof foo.bar !== 'undefined')", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 13, +}), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(typeof foo.bar !== 'undefined')", "test/fixtures/UnaryExpression/fixture.js", 13, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"!==\",\"left\":{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[14,17]},\"property\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[18,21]},\"computed\":false,\"range\":[14,21]},\"prefix\":true,\"range\":[7,21]},\"right\":{\"type\":\"StringLiteral\",\"value\":\"undefined\",\"range\":[26,37]},\"range\":[7,37]}],\"range\":[0,38]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\".\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[18,21]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"!==\",\"range\":[22,25]},{\"type\":{\"label\":\"string\"},\"value\":\"undefined\",\"range\":[26,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", - visitorKeys: _powerAssertVisitorKeys -})); -assert.strictEqual(_rec7._expr(_rec7._capt(typeof foo === "undefined" ? "undefined" : _typeof(foo), "arguments/0"), { - content: "assert.strictEqual(typeof foo, typeof bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 15, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[26,29]},\"prefix\":true,\"range\":[19,29]},{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[38,41]},\"prefix\":true,\"range\":[31,41]}],\"range\":[0,42]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[19,25]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[26,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[31,37]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[38,41]},{\"type\":{\"label\":\")\"},\"range\":[41,42]}]", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[7,13]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[14,17]},{\"type\":{\"label\":\".\"},\"range\":[17,18]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[18,21]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"!==\",\"range\":[22,25]},{\"type\":{\"label\":\"string\"},\"value\":\"undefined\",\"range\":[26,37]},{\"type\":{\"label\":\")\"},\"range\":[37,38]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec8._expr(_rec8._capt(typeof bar === "undefined" ? "undefined" : _typeof(bar), "arguments/1"), { - content: "assert.strictEqual(typeof foo, typeof bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 15, +}), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(4, "assert.strictEqual(typeof foo, typeof bar)", "test/fixtures/UnaryExpression/fixture.js", 15, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[26,29]},\"prefix\":true,\"range\":[19,29]},{\"type\":\"UnaryExpression\",\"operator\":\"typeof\",\"argument\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[38,41]},\"prefix\":true,\"range\":[31,41]}],\"range\":[0,42]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[19,25]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[26,29]},{\"type\":{\"label\":\",\"},\"range\":[29,30]},{\"type\":{\"label\":\"typeof\"},\"value\":\"typeof\",\"range\":[31,37]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[38,41]},{\"type\":{\"label\":\")\"},\"range\":[41,42]}]", visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag7 = new _ArgumentRecorder(assert.strictEqual, _am7, 0), + _ag8 = new _ArgumentRecorder(assert.strictEqual, _am7, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(!_ag._tap(truth, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(!_ag2._tap(!_ag2._tap(some, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(!_ag3._tap(!_ag3._tap(_ag3._tap(foo, "arguments/0/argument/argument/object").bar, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(delete _ag4._tap(_ag4._tap(foo, "arguments/0/argument/object").bar, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(typeof foo === "undefined" ? "undefined" : _typeof(foo), "arguments/0/left") !== 'undefined', "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(_typeof(_ag6._tap(_ag6._tap(foo, "arguments/0/left/argument/object").bar, "arguments/0/left/argument")), "arguments/0/left") !== 'undefined', "arguments/0"), new _AssertionMessage(_am6, -1)); +assert.strictEqual(_ag7._rec(typeof foo === "undefined" ? "undefined" : _typeof(foo), "arguments/0"), _ag8._rec(typeof bar === "undefined" ? "undefined" : _typeof(bar), "arguments/1"), new _AssertionMessage(_am7, -1)); diff --git a/test/fixtures/UnaryExpression/expected.js b/test/fixtures/UnaryExpression/expected.js index aacd543..7e3d397 100644 --- a/test/fixtures/UnaryExpression/expected.js +++ b/test/fixtures/UnaryExpression/expected.js @@ -1,51 +1,29 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(!truth)", "test/fixtures/UnaryExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(!!some)", "test/fixtures/UnaryExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(0, "assert(!!foo.bar)", "test/fixtures/UnaryExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert, _am3, 0), + _am4 = _pwmeta(0, "assert(delete foo.bar)", "test/fixtures/UnaryExpression/fixture.js", 9), + _ag4 = new _ArgumentRecorder(assert, _am4, 0), + _am5 = _pwmeta(0, "assert(typeof foo !== 'undefined')", "test/fixtures/UnaryExpression/fixture.js", 11), + _ag5 = new _ArgumentRecorder(assert, _am5, 0), + _am6 = _pwmeta(0, "assert(typeof foo.bar !== 'undefined')", "test/fixtures/UnaryExpression/fixture.js", 13), + _ag6 = new _ArgumentRecorder(assert, _am6, 0), + _am7 = _pwmeta(4, "assert.strictEqual(typeof foo, typeof bar)", "test/fixtures/UnaryExpression/fixture.js", 15), + _ag7 = new _ArgumentRecorder(assert.strictEqual, _am7, 0), + _ag8 = new _ArgumentRecorder(assert.strictEqual, _am7, 1); -assert(_rec._expr(_rec._capt(!_rec._capt(truth, "arguments/0/argument"), "arguments/0"), { - content: "assert(!truth)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(!_rec2._capt(!_rec2._capt(some, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), { - content: "assert(!!some)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 5 -})); -assert(_rec3._expr(_rec3._capt(!_rec3._capt(!_rec3._capt(_rec3._capt(foo, "arguments/0/argument/argument/object").bar, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), { - content: "assert(!!foo.bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 7 -})); -assert(_rec4._expr(_rec4._capt(delete _rec4._capt(_rec4._capt(foo, "arguments/0/argument/object").bar, "arguments/0/argument"), "arguments/0"), { - content: "assert(delete foo.bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 9 -})); -assert(_rec5._expr(_rec5._capt(_rec5._capt(typeof foo, "arguments/0/left") !== 'undefined', "arguments/0"), { - content: "assert(typeof foo !== 'undefined')", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 11 -})); -assert(_rec6._expr(_rec6._capt(_rec6._capt(typeof _rec6._capt(_rec6._capt(foo, "arguments/0/left/argument/object").bar, "arguments/0/left/argument"), "arguments/0/left") !== 'undefined', "arguments/0"), { - content: "assert(typeof foo.bar !== 'undefined')", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 13 -})); -assert.strictEqual(_rec7._expr(_rec7._capt(typeof foo, "arguments/0"), { - content: "assert.strictEqual(typeof foo, typeof bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 15 -}), _rec8._expr(_rec8._capt(typeof bar, "arguments/1"), { - content: "assert.strictEqual(typeof foo, typeof bar)", - filepath: "test/fixtures/UnaryExpression/fixture.js", - line: 15 -})); +assert(_ag._rec(!_ag._tap(truth, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(!_ag2._tap(!_ag2._tap(some, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am2, -1)); +assert(_ag3._rec(!_ag3._tap(!_ag3._tap(_ag3._tap(foo, "arguments/0/argument/argument/object").bar, "arguments/0/argument/argument"), "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am3, -1)); +assert(_ag4._rec(delete _ag4._tap(_ag4._tap(foo, "arguments/0/argument/object").bar, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am4, -1)); +assert(_ag5._rec(_ag5._tap(typeof foo, "arguments/0/left") !== 'undefined', "arguments/0"), new _AssertionMessage(_am5, -1)); +assert(_ag6._rec(_ag6._tap(typeof _ag6._tap(_ag6._tap(foo, "arguments/0/left/argument/object").bar, "arguments/0/left/argument"), "arguments/0/left") !== 'undefined', "arguments/0"), new _AssertionMessage(_am6, -1)); +assert.strictEqual(_ag7._rec(typeof foo, "arguments/0"), _ag8._rec(typeof bar, "arguments/1"), new _AssertionMessage(_am7, -1)); diff --git a/test/fixtures/UpdateExpression/expected-presets-env.js b/test/fixtures/UpdateExpression/expected-presets-env.js index dd92940..11b0213 100644 --- a/test/fixtures/UpdateExpression/expected-presets-env.js +++ b/test/fixtures/UpdateExpression/expected-presets-env.js @@ -1,40 +1,38 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); - -assert(_rec._expr(_rec._capt(++foo, "arguments/0"), { - content: "assert(++foo)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 3, +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(++foo)", "test/fixtures/UpdateExpression/fixture.js", 3, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UpdateExpression\",\"operator\":\"++\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[9,12]},\"prefix\":true,\"range\":[7,12]}],\"range\":[0,13]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"++/--\"},\"value\":\"++\",\"range\":[7,9]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[9,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert(_rec2._expr(_rec2._capt(bar--, "arguments/0"), { - content: "assert(bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 5, +}), + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(bar--)", "test/fixtures/UpdateExpression/fixture.js", 5, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"UpdateExpression\",\"operator\":\"--\",\"argument\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[7,10]},\"prefix\":false,\"range\":[7,12]}],\"range\":[0,13]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[7,10]},{\"type\":{\"label\":\"++/--\"},\"value\":\"--\",\"range\":[10,12]},{\"type\":{\"label\":\")\"},\"range\":[12,13]}]", visitorKeys: _powerAssertVisitorKeys -})); -assert.strictEqual(_rec3._expr(_rec3._capt(++foo, "arguments/0"), { - content: "assert.strictEqual(++foo, bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 7, +}), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(4, "assert.strictEqual(++foo, bar--)", "test/fixtures/UpdateExpression/fixture.js", 7, { ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"UpdateExpression\",\"operator\":\"++\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[21,24]},\"prefix\":true,\"range\":[19,24]},{\"type\":\"UpdateExpression\",\"operator\":\"--\",\"argument\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[26,29]},\"prefix\":false,\"range\":[26,31]}],\"range\":[0,32]}", tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"++/--\"},\"value\":\"++\",\"range\":[19,21]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[26,29]},{\"type\":{\"label\":\"++/--\"},\"value\":\"--\",\"range\":[29,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]}]", visitorKeys: _powerAssertVisitorKeys -}), _rec4._expr(_rec4._capt(bar--, "arguments/1"), { - content: "assert.strictEqual(++foo, bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 7, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"MemberExpression\",\"object\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"property\":{\"type\":\"Identifier\",\"name\":\"strictEqual\",\"range\":[7,18]},\"computed\":false,\"range\":[0,18]},\"arguments\":[{\"type\":\"UpdateExpression\",\"operator\":\"++\",\"argument\":{\"type\":\"Identifier\",\"name\":\"foo\",\"range\":[21,24]},\"prefix\":true,\"range\":[19,24]},{\"type\":\"UpdateExpression\",\"operator\":\"--\",\"argument\":{\"type\":\"Identifier\",\"name\":\"bar\",\"range\":[26,29]},\"prefix\":false,\"range\":[26,31]}],\"range\":[0,32]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\".\"},\"range\":[6,7]},{\"type\":{\"label\":\"name\"},\"value\":\"strictEqual\",\"range\":[7,18]},{\"type\":{\"label\":\"(\"},\"range\":[18,19]},{\"type\":{\"label\":\"++/--\"},\"value\":\"++\",\"range\":[19,21]},{\"type\":{\"label\":\"name\"},\"value\":\"foo\",\"range\":[21,24]},{\"type\":{\"label\":\",\"},\"range\":[24,25]},{\"type\":{\"label\":\"name\"},\"value\":\"bar\",\"range\":[26,29]},{\"type\":{\"label\":\"++/--\"},\"value\":\"--\",\"range\":[29,31]},{\"type\":{\"label\":\")\"},\"range\":[31,32]}]", - visitorKeys: _powerAssertVisitorKeys -})); +}), + _ag3 = new _ArgumentRecorder(assert.strictEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.strictEqual, _am3, 1); + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +assert(_ag._rec(++foo, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(bar--, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.strictEqual(_ag3._rec(++foo, "arguments/0"), _ag4._rec(bar--, "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/UpdateExpression/expected.js b/test/fixtures/UpdateExpression/expected.js index a7e1390..efe4a14 100644 --- a/test/fixtures/UpdateExpression/expected.js +++ b/test/fixtures/UpdateExpression/expected.js @@ -1,27 +1,17 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert(++foo)", "test/fixtures/UpdateExpression/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert(bar--)", "test/fixtures/UpdateExpression/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert, _am2, 0), + _am3 = _pwmeta(4, "assert.strictEqual(++foo, bar--)", "test/fixtures/UpdateExpression/fixture.js", 7), + _ag3 = new _ArgumentRecorder(assert.strictEqual, _am3, 0), + _ag4 = new _ArgumentRecorder(assert.strictEqual, _am3, 1); -assert(_rec._expr(_rec._capt(++foo, "arguments/0"), { - content: "assert(++foo)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 3 -})); -assert(_rec2._expr(_rec2._capt(bar--, "arguments/0"), { - content: "assert(bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 5 -})); -assert.strictEqual(_rec3._expr(_rec3._capt(++foo, "arguments/0"), { - content: "assert.strictEqual(++foo, bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 7 -}), _rec4._expr(_rec4._capt(bar--, "arguments/1"), { - content: "assert.strictEqual(++foo, bar--)", - filepath: "test/fixtures/UpdateExpression/fixture.js", - line: 7 -})); +assert(_ag._rec(++foo, "arguments/0"), new _AssertionMessage(_am, -1)); +assert(_ag2._rec(bar--, "arguments/0"), new _AssertionMessage(_am2, -1)); +assert.strictEqual(_ag3._rec(++foo, "arguments/0"), _ag4._rec(bar--, "arguments/1"), new _AssertionMessage(_am3, -1)); diff --git a/test/fixtures/YieldExpression/expected-presets-env.js b/test/fixtures/YieldExpression/expected-presets-env.js index d898d55..e819c94 100644 --- a/test/fixtures/YieldExpression/expected-presets-env.js +++ b/test/fixtures/YieldExpression/expected-presets-env.js @@ -1,49 +1,56 @@ 'use strict'; -var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"ParenthesizedExpression\":[\"expression\"],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", - _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _powerAssertVisitorKeys = "{\"ArrayExpression\":[\"elements\"],\"AssignmentExpression\":[\"left\",\"right\"],\"BinaryExpression\":[\"left\",\"right\"],\"InterpreterDirective\":[],\"Directive\":[\"value\"],\"DirectiveLiteral\":[],\"BlockStatement\":[\"directives\",\"body\"],\"BreakStatement\":[\"label\"],\"CallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"CatchClause\":[\"param\",\"body\"],\"ConditionalExpression\":[\"test\",\"consequent\",\"alternate\"],\"ContinueStatement\":[\"label\"],\"DebuggerStatement\":[],\"DoWhileStatement\":[\"test\",\"body\"],\"EmptyStatement\":[],\"ExpressionStatement\":[\"expression\"],\"File\":[\"program\"],\"ForInStatement\":[\"left\",\"right\",\"body\"],\"ForStatement\":[\"init\",\"test\",\"update\",\"body\"],\"FunctionDeclaration\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"FunctionExpression\":[\"id\",\"params\",\"body\",\"returnType\",\"typeParameters\"],\"Identifier\":[\"typeAnnotation\",\"decorators\"],\"IfStatement\":[\"test\",\"consequent\",\"alternate\"],\"LabeledStatement\":[\"label\",\"body\"],\"StringLiteral\":[],\"NumericLiteral\":[],\"NullLiteral\":[],\"BooleanLiteral\":[],\"RegExpLiteral\":[],\"LogicalExpression\":[\"left\",\"right\"],\"MemberExpression\":[\"object\",\"property\"],\"NewExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"Program\":[\"directives\",\"body\"],\"ObjectExpression\":[\"properties\"],\"ObjectMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectProperty\":[\"key\",\"value\",\"decorators\"],\"RestElement\":[\"argument\",\"typeAnnotation\"],\"ReturnStatement\":[\"argument\"],\"SequenceExpression\":[\"expressions\"],\"ParenthesizedExpression\":[\"expression\"],\"SwitchCase\":[\"test\",\"consequent\"],\"SwitchStatement\":[\"discriminant\",\"cases\"],\"ThisExpression\":[],\"ThrowStatement\":[\"argument\"],\"TryStatement\":[\"block\",\"handler\",\"finalizer\"],\"UnaryExpression\":[\"argument\"],\"UpdateExpression\":[\"argument\"],\"VariableDeclaration\":[\"declarations\"],\"VariableDeclarator\":[\"id\",\"init\"],\"WhileStatement\":[\"test\",\"body\"],\"WithStatement\":[\"object\",\"body\"],\"AssignmentPattern\":[\"left\",\"right\",\"decorators\"],\"ArrayPattern\":[\"elements\",\"typeAnnotation\"],\"ArrowFunctionExpression\":[\"params\",\"body\",\"returnType\",\"typeParameters\"],\"ClassBody\":[\"body\"],\"ClassDeclaration\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ClassExpression\":[\"id\",\"body\",\"superClass\",\"mixins\",\"typeParameters\",\"superTypeParameters\",\"implements\",\"decorators\"],\"ExportAllDeclaration\":[\"source\"],\"ExportDefaultDeclaration\":[\"declaration\"],\"ExportNamedDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"ExportSpecifier\":[\"local\",\"exported\"],\"ForOfStatement\":[\"left\",\"right\",\"body\"],\"ImportDeclaration\":[\"specifiers\",\"source\"],\"ImportDefaultSpecifier\":[\"local\"],\"ImportNamespaceSpecifier\":[\"local\"],\"ImportSpecifier\":[\"local\",\"imported\"],\"MetaProperty\":[\"meta\",\"property\"],\"ClassMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"ObjectPattern\":[\"properties\",\"typeAnnotation\",\"decorators\"],\"SpreadElement\":[\"argument\"],\"Super\":[],\"TaggedTemplateExpression\":[\"tag\",\"quasi\"],\"TemplateElement\":[],\"TemplateLiteral\":[\"quasis\",\"expressions\"],\"YieldExpression\":[\"argument\"],\"AnyTypeAnnotation\":[],\"ArrayTypeAnnotation\":[\"elementType\"],\"BooleanTypeAnnotation\":[],\"BooleanLiteralTypeAnnotation\":[],\"NullLiteralTypeAnnotation\":[],\"ClassImplements\":[\"id\",\"typeParameters\"],\"DeclareClass\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareFunction\":[\"id\"],\"DeclareInterface\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"DeclareModule\":[\"id\",\"body\"],\"DeclareModuleExports\":[\"typeAnnotation\"],\"DeclareTypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"DeclareOpaqueType\":[\"id\",\"typeParameters\",\"supertype\"],\"DeclareVariable\":[\"id\"],\"DeclareExportDeclaration\":[\"declaration\",\"specifiers\",\"source\"],\"DeclareExportAllDeclaration\":[\"source\"],\"DeclaredPredicate\":[\"value\"],\"ExistsTypeAnnotation\":[],\"FunctionTypeAnnotation\":[\"typeParameters\",\"params\",\"rest\",\"returnType\"],\"FunctionTypeParam\":[\"name\",\"typeAnnotation\"],\"GenericTypeAnnotation\":[\"id\",\"typeParameters\"],\"InferredPredicate\":[],\"InterfaceExtends\":[\"id\",\"typeParameters\"],\"InterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"mixins\",\"implements\",\"body\"],\"InterfaceTypeAnnotation\":[\"extends\",\"body\"],\"IntersectionTypeAnnotation\":[\"types\"],\"MixedTypeAnnotation\":[],\"EmptyTypeAnnotation\":[],\"NullableTypeAnnotation\":[\"typeAnnotation\"],\"NumberLiteralTypeAnnotation\":[],\"NumberTypeAnnotation\":[],\"ObjectTypeAnnotation\":[\"properties\",\"indexers\",\"callProperties\",\"internalSlots\"],\"ObjectTypeInternalSlot\":[\"id\",\"value\",\"optional\",\"static\",\"method\"],\"ObjectTypeCallProperty\":[\"value\"],\"ObjectTypeIndexer\":[\"id\",\"key\",\"value\",\"variance\"],\"ObjectTypeProperty\":[\"key\",\"value\",\"variance\"],\"ObjectTypeSpreadProperty\":[\"argument\"],\"OpaqueType\":[\"id\",\"typeParameters\",\"supertype\",\"impltype\"],\"QualifiedTypeIdentifier\":[\"id\",\"qualification\"],\"StringLiteralTypeAnnotation\":[],\"StringTypeAnnotation\":[],\"ThisTypeAnnotation\":[],\"TupleTypeAnnotation\":[\"types\"],\"TypeofTypeAnnotation\":[\"argument\"],\"TypeAlias\":[\"id\",\"typeParameters\",\"right\"],\"TypeAnnotation\":[\"typeAnnotation\"],\"TypeCastExpression\":[\"expression\",\"typeAnnotation\"],\"TypeParameter\":[\"bound\",\"default\",\"variance\"],\"TypeParameterDeclaration\":[\"params\"],\"TypeParameterInstantiation\":[\"params\"],\"UnionTypeAnnotation\":[\"types\"],\"Variance\":[],\"VoidTypeAnnotation\":[],\"JSXAttribute\":[\"name\",\"value\"],\"JSXClosingElement\":[\"name\"],\"JSXElement\":[\"openingElement\",\"children\",\"closingElement\"],\"JSXEmptyExpression\":[],\"JSXExpressionContainer\":[\"expression\"],\"JSXSpreadChild\":[\"expression\"],\"JSXIdentifier\":[],\"JSXMemberExpression\":[\"object\",\"property\"],\"JSXNamespacedName\":[\"namespace\",\"name\"],\"JSXOpeningElement\":[\"name\",\"attributes\"],\"JSXSpreadAttribute\":[\"argument\"],\"JSXText\":[],\"JSXFragment\":[\"openingFragment\",\"children\",\"closingFragment\"],\"JSXOpeningFragment\":[],\"JSXClosingFragment\":[],\"Noop\":[],\"Placeholder\":[],\"ArgumentPlaceholder\":[],\"AwaitExpression\":[\"argument\"],\"BindExpression\":[\"object\",\"callee\"],\"ClassProperty\":[\"key\",\"value\",\"typeAnnotation\",\"decorators\"],\"OptionalMemberExpression\":[\"object\",\"property\"],\"PipelineTopicExpression\":[\"expression\"],\"PipelineBareFunction\":[\"callee\"],\"PipelinePrimaryTopicReference\":[],\"OptionalCallExpression\":[\"callee\",\"arguments\",\"typeParameters\",\"typeArguments\"],\"ClassPrivateProperty\":[\"key\",\"value\"],\"ClassPrivateMethod\":[\"key\",\"params\",\"body\",\"decorators\",\"returnType\",\"typeParameters\"],\"Import\":[],\"Decorator\":[\"expression\"],\"DoExpression\":[\"body\"],\"ExportDefaultSpecifier\":[\"exported\"],\"ExportNamespaceSpecifier\":[\"exported\"],\"PrivateName\":[\"id\"],\"BigIntLiteral\":[],\"TSParameterProperty\":[\"parameter\"],\"TSDeclareFunction\":[\"id\",\"typeParameters\",\"params\",\"returnType\"],\"TSDeclareMethod\":[\"decorators\",\"key\",\"typeParameters\",\"params\",\"returnType\"],\"TSQualifiedName\":[\"left\",\"right\"],\"TSCallSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructSignatureDeclaration\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSPropertySignature\":[\"key\",\"typeAnnotation\",\"initializer\"],\"TSMethodSignature\":[\"key\",\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSIndexSignature\":[\"parameters\",\"typeAnnotation\"],\"TSAnyKeyword\":[],\"TSUnknownKeyword\":[],\"TSNumberKeyword\":[],\"TSObjectKeyword\":[],\"TSBooleanKeyword\":[],\"TSStringKeyword\":[],\"TSSymbolKeyword\":[],\"TSVoidKeyword\":[],\"TSUndefinedKeyword\":[],\"TSNullKeyword\":[],\"TSNeverKeyword\":[],\"TSThisType\":[],\"TSFunctionType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSConstructorType\":[\"typeParameters\",\"parameters\",\"typeAnnotation\"],\"TSTypeReference\":[\"typeName\",\"typeParameters\"],\"TSTypePredicate\":[\"parameterName\",\"typeAnnotation\"],\"TSTypeQuery\":[\"exprName\"],\"TSTypeLiteral\":[\"members\"],\"TSArrayType\":[\"elementType\"],\"TSTupleType\":[\"elementTypes\"],\"TSOptionalType\":[\"typeAnnotation\"],\"TSRestType\":[\"typeAnnotation\"],\"TSUnionType\":[\"types\"],\"TSIntersectionType\":[\"types\"],\"TSConditionalType\":[\"checkType\",\"extendsType\",\"trueType\",\"falseType\"],\"TSInferType\":[\"typeParameter\"],\"TSParenthesizedType\":[\"typeAnnotation\"],\"TSTypeOperator\":[\"typeAnnotation\"],\"TSIndexedAccessType\":[\"objectType\",\"indexType\"],\"TSMappedType\":[\"typeParameter\",\"typeAnnotation\"],\"TSLiteralType\":[\"literal\"],\"TSExpressionWithTypeArguments\":[\"expression\",\"typeParameters\"],\"TSInterfaceDeclaration\":[\"id\",\"typeParameters\",\"extends\",\"body\"],\"TSInterfaceBody\":[\"body\"],\"TSTypeAliasDeclaration\":[\"id\",\"typeParameters\",\"typeAnnotation\"],\"TSAsExpression\":[\"expression\",\"typeAnnotation\"],\"TSTypeAssertion\":[\"typeAnnotation\",\"expression\"],\"TSEnumDeclaration\":[\"id\",\"members\"],\"TSEnumMember\":[\"id\",\"initializer\"],\"TSModuleDeclaration\":[\"id\",\"body\"],\"TSModuleBlock\":[\"body\"],\"TSImportType\":[\"argument\",\"qualifier\",\"typeParameters\"],\"TSImportEqualsDeclaration\":[\"id\",\"moduleReference\"],\"TSExternalModuleReference\":[\"expression\"],\"TSNonNullExpression\":[\"expression\"],\"TSExportAssignment\":[\"expression\"],\"TSNamespaceExportDeclaration\":[\"id\"],\"TSTypeAnnotation\":[\"typeAnnotation\"],\"TSTypeParameterInstantiation\":[\"params\"],\"TSTypeParameterDeclaration\":[\"params\"],\"TSTypeParameter\":[\"constraint\",\"default\"]}", + _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = function _pwmeta(ptnidx, content, filepath, line, extra) { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content: content, filepath: filepath, line: line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { var isPromiseLike = function isPromiseLike(o) { return o !== null && _typeof(o) === "object" && typeof o.then === "function" && typeof o["catch"] === "function"; }; var mark = function mark(_this, s) { return function () { var args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; var $Promise$ = function $Promise$(prms) { _classCallCheck(this, $Promise$); this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); }; var wrap = function wrap(v) { return isPromiseLike(v) ? new $Promise$(v) : v; }; var ArgumentRecorder = /*#__PURE__*/ function () { function ArgumentRecorder(callee, am, matchIndex) { _classCallCheck(this, ArgumentRecorder); this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; var conf = am.params[matchIndex]; this._isBlock = !!conf.block; } _createClass(ArgumentRecorder, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { return this._val; } }, { key: "_tap", value: function _tap(value, espath) { this._logs.push({ value: wrap(value), espath: espath }); return value; } }, { key: "_rec", value: function _rec(value, espath) { var empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; var log = { value: wrap(value), espath: espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply: function apply(target, thisArg, args) { try { var ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value: value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } }, { key: "eject", value: function eject() { var ret = this._recorded; this._recorded = null; this._val = null; return ret; } }]); return ArgumentRecorder; }(); return ArgumentRecorder; }(), + _AssertionMessage = function () { var _s = "\n\n "; var AssertionMessage = /*#__PURE__*/ function () { function AssertionMessage(am, matchIndex, msgOrRec) { _classCallCheck(this, AssertionMessage); this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } _createClass(AssertionMessage, [{ key: "metadata", value: function metadata() { return this._am; } }, { key: "matchIndex", value: function matchIndex() { return this._idx; } }, { key: "val", value: function val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } }, { key: "eject", value: function eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } }, { key: "toString", value: function toString() { var msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += "".concat(_s, "# ").concat(this._am.filepath, ":").concat(this._am.line); msg += "".concat(_s).concat(this._am.content); msg += "".concat(_s, "[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert"); msg += "\n"; return msg; } }]); return AssertionMessage; }(); return AssertionMessage; }(); var _marked = /*#__PURE__*/ regeneratorRuntime.mark(gen); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + function gen(a) { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert((yield a) === 3)", "test/fixtures/YieldExpression/fixture.js", 4, { + generator: true, + ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"YieldExpression\",\"argument\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[14,15]},\"delegate\":false,\"range\":[8,15]},\"right\":{\"type\":\"NumericLiteral\",\"value\":3,\"range\":[21,22]},\"range\":[7,22]}],\"range\":[0,23]}", + tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"name\"},\"value\":\"yield\",\"range\":[8,13]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\"==/!=/===/!==\"},\"value\":\"===\",\"range\":[17,20]},{\"type\":{\"label\":\"num\"},\"value\":3,\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", + visitorKeys: _powerAssertVisitorKeys + }), + _ag = new _ArgumentRecorder(assert, _am, 0); return regeneratorRuntime.wrap(function gen$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.t0 = assert; - _context.t1 = _rec; - _context.t2 = _rec; - _context.t3 = _rec; - _context.next = 6; - return a; - - case 6: - _context.t4 = _context.sent; - _context.t5 = _context.t3._capt.call(_context.t3, _context.t4, "arguments/0/left"); - _context.t6 = _context.t5 === 3; - _context.t7 = _context.t2._capt.call(_context.t2, _context.t6, "arguments/0"); - _context.t8 = { - content: "assert((yield a) === 3)", - filepath: "test/fixtures/YieldExpression/fixture.js", - line: 4, - generator: true, - ast: "{\"type\":\"CallExpression\",\"callee\":{\"type\":\"Identifier\",\"name\":\"assert\",\"range\":[0,6]},\"arguments\":[{\"type\":\"BinaryExpression\",\"operator\":\"===\",\"left\":{\"type\":\"YieldExpression\",\"argument\":{\"type\":\"Identifier\",\"name\":\"a\",\"range\":[14,15]},\"delegate\":false,\"range\":[8,15]},\"right\":{\"type\":\"NumericLiteral\",\"value\":3,\"range\":[21,22]},\"range\":[7,22]}],\"range\":[0,23]}", - tokens: "[{\"type\":{\"label\":\"name\"},\"value\":\"assert\",\"range\":[0,6]},{\"type\":{\"label\":\"(\"},\"range\":[6,7]},{\"type\":{\"label\":\"(\"},\"range\":[7,8]},{\"type\":{\"label\":\"yield\"},\"value\":\"yield\",\"range\":[8,13]},{\"type\":{\"label\":\"name\"},\"value\":\"a\",\"range\":[14,15]},{\"type\":{\"label\":\")\"},\"range\":[15,16]},{\"type\":{\"label\":\"==/!=\"},\"value\":\"===\",\"range\":[17,20]},{\"type\":{\"label\":\"num\"},\"value\":3,\"range\":[21,22]},{\"type\":{\"label\":\")\"},\"range\":[22,23]}]", - visitorKeys: _powerAssertVisitorKeys - }; - _context.t9 = _context.t1._expr.call(_context.t1, _context.t7, _context.t8); - (0, _context.t0)(_context.t9); - - case 13: + _context.t1 = _ag; + _context.t2 = _ag; + _context.next = 5; + return _ag._tap(a, "arguments/0/left/argument"); + + case 5: + _context.t3 = _context.sent; + _context.t4 = _context.t2._tap.call(_context.t2, _context.t3, "arguments/0/left"); + _context.t5 = _context.t4 === 3; + _context.t6 = _context.t1._rec.call(_context.t1, _context.t5, "arguments/0"); + _context.t7 = new _AssertionMessage(_am, -1); + (0, _context.t0)(_context.t6, _context.t7); + + case 11: case "end": return _context.stop(); } } - }, _marked, this); + }, _marked); } // function notGen(a){ // assert((yield (a)) === 3); // } diff --git a/test/fixtures/YieldExpression/expected.js b/test/fixtures/YieldExpression/expected.js index 75c5e39..a176a82 100644 --- a/test/fixtures/YieldExpression/expected.js +++ b/test/fixtures/YieldExpression/expected.js @@ -1,16 +1,17 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); function* gen(a) { - var _rec = new _powerAssertRecorder(); - - assert(_rec._expr(_rec._capt(_rec._capt((yield a), "arguments/0/left") === 3, "arguments/0"), { - content: "assert((yield a) === 3)", - filepath: "test/fixtures/YieldExpression/fixture.js", - line: 4, + var _am = _pwmeta(0, "assert((yield a) === 3)", "test/fixtures/YieldExpression/fixture.js", 4, { generator: true - })); + }), + _ag = new _ArgumentRecorder(assert, _am, 0); + + assert(_ag._rec(_ag._tap((yield _ag._tap(a, "arguments/0/left/argument")), "arguments/0/left") === 3, "arguments/0"), new _AssertionMessage(_am, -1)); } // function notGen(a){ // assert((yield (a)) === 3); // } diff --git a/test/fixtures/customPatterns/expected.js b/test/fixtures/customPatterns/expected.js index 85ef205..5354069 100644 --- a/test/fixtures/customPatterns/expected.js +++ b/test/fixtures/customPatterns/expected.js @@ -1,71 +1,35 @@ 'use strict'; -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(), - _rec = new _powerAssertRecorder(), - _rec2 = new _powerAssertRecorder(), - _rec3 = new _powerAssertRecorder(), - _rec4 = new _powerAssertRecorder(), - _rec5 = new _powerAssertRecorder(), - _rec6 = new _powerAssertRecorder(), - _rec7 = new _powerAssertRecorder(), - _rec8 = new _powerAssertRecorder(), - _rec9 = new _powerAssertRecorder(), - _rec10 = new _powerAssertRecorder(), - _rec11 = new _powerAssertRecorder(), - _rec12 = new _powerAssertRecorder(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert.isNull(object, [message])\",\"params\":[{\"index\":0,\"name\":\"object\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.same(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.near(actual, expected, delta, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"delta\",\"kind\":\"mandatory\"},{\"index\":3,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _am = _pwmeta(0, "assert.isNull(falsy)", "test/fixtures/customPatterns/fixture.js", 3), + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _ag = new _ArgumentRecorder(assert.isNull, _am, 0), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(), + _am2 = _pwmeta(0, "assert.isNull(falsy, message)", "test/fixtures/customPatterns/fixture.js", 5), + _ag2 = new _ArgumentRecorder(assert.isNull, _am2, 0), + _ag3 = new _ArgumentRecorder(assert.isNull, _am2, 1), + _am3 = _pwmeta(1, "assert.same(foo, bar)", "test/fixtures/customPatterns/fixture.js", 7), + _ag4 = new _ArgumentRecorder(assert.same, _am3, 0), + _ag5 = new _ArgumentRecorder(assert.same, _am3, 1), + _am4 = _pwmeta(1, "assert.same(foo, bar, message)", "test/fixtures/customPatterns/fixture.js", 9), + _ag6 = new _ArgumentRecorder(assert.same, _am4, 0), + _ag7 = new _ArgumentRecorder(assert.same, _am4, 1), + _ag8 = new _ArgumentRecorder(assert.same, _am4, 2), + _am5 = _pwmeta(2, "assert.near(actualVal, expectedVal, delta)", "test/fixtures/customPatterns/fixture.js", 13), + _ag9 = new _ArgumentRecorder(assert.near, _am5, 0), + _ag10 = new _ArgumentRecorder(assert.near, _am5, 1), + _ag11 = new _ArgumentRecorder(assert.near, _am5, 2), + _am6 = _pwmeta(2, "assert.near(actualVal, expectedVal, delta, message)", "test/fixtures/customPatterns/fixture.js", 15), + _ag12 = new _ArgumentRecorder(assert.near, _am6, 0), + _ag13 = new _ArgumentRecorder(assert.near, _am6, 1), + _ag14 = new _ArgumentRecorder(assert.near, _am6, 2), + _ag15 = new _ArgumentRecorder(assert.near, _am6, 3); -assert.isNull(_rec._expr(_rec._capt(falsy, "arguments/0"), { - content: "assert.isNull(falsy)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 3 -})); -assert.isNull(_rec2._expr(_rec2._capt(falsy, "arguments/0"), { - content: "assert.isNull(falsy, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 5 -}), message); -assert.same(_rec3._expr(_rec3._capt(foo, "arguments/0"), { - content: "assert.same(foo, bar)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 7 -}), _rec4._expr(_rec4._capt(bar, "arguments/1"), { - content: "assert.same(foo, bar)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 7 -})); -assert.same(_rec5._expr(_rec5._capt(foo, "arguments/0"), { - content: "assert.same(foo, bar, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 9 -}), _rec6._expr(_rec6._capt(bar, "arguments/1"), { - content: "assert.same(foo, bar, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 9 -}), message); +assert.isNull(_ag._rec(falsy, "arguments/0"), new _AssertionMessage(_am, -1)); +assert.isNull(_ag2._rec(falsy, "arguments/0"), new _AssertionMessage(_am2, 1, _ag3._rec(message, "arguments/1"))); +assert.same(_ag4._rec(foo, "arguments/0"), _ag5._rec(bar, "arguments/1"), new _AssertionMessage(_am3, -1)); +assert.same(_ag6._rec(foo, "arguments/0"), _ag7._rec(bar, "arguments/1"), new _AssertionMessage(_am4, 2, _ag8._rec(message, "arguments/2"))); assert.near(actualVal, expectedVal); -assert.near(_rec7._expr(_rec7._capt(actualVal, "arguments/0"), { - content: "assert.near(actualVal, expectedVal, delta)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 13 -}), _rec8._expr(_rec8._capt(expectedVal, "arguments/1"), { - content: "assert.near(actualVal, expectedVal, delta)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 13 -}), _rec9._expr(_rec9._capt(delta, "arguments/2"), { - content: "assert.near(actualVal, expectedVal, delta)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 13 -})); -assert.near(_rec10._expr(_rec10._capt(actualVal, "arguments/0"), { - content: "assert.near(actualVal, expectedVal, delta, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 15 -}), _rec11._expr(_rec11._capt(expectedVal, "arguments/1"), { - content: "assert.near(actualVal, expectedVal, delta, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 15 -}), _rec12._expr(_rec12._capt(delta, "arguments/2"), { - content: "assert.near(actualVal, expectedVal, delta, message)", - filepath: "test/fixtures/customPatterns/fixture.js", - line: 15 -}), message); +assert.near(_ag9._rec(actualVal, "arguments/0"), _ag10._rec(expectedVal, "arguments/1"), _ag11._rec(delta, "arguments/2"), new _AssertionMessage(_am5, -1)); +assert.near(_ag12._rec(actualVal, "arguments/0"), _ag13._rec(expectedVal, "arguments/1"), _ag14._rec(delta, "arguments/2"), new _AssertionMessage(_am6, 3, _ag15._rec(message, "arguments/3"))); diff --git a/test/fixtures/inputSourceMap/expected.js b/test/fixtures/inputSourceMap/expected.js index 31e8bd3..438bb1f 100644 --- a/test/fixtures/inputSourceMap/expected.js +++ b/test/fixtures/inputSourceMap/expected.js @@ -1,4 +1,7 @@ -var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { var capturedValues = this.captured; this.captured = []; return { powerAssertContext: { value: value, events: capturedValues }, source: source }; }; return PowerAssertRecorder; }(); +var _pwptn = JSON.parse("[{\"pattern\":\"assert(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.ok(value, [message])\",\"params\":[{\"index\":0,\"name\":\"value\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.equal(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.strictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\"},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\"},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.deepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":3}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.notDeepStrictEqual(actual, expected, [message])\",\"params\":[{\"index\":0,\"name\":\"actual\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":1,\"name\":\"expected\",\"kind\":\"mandatory\",\"options\":{\"maxDepth\":2}},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.throws(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotThrow(fn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"fn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.rejects(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]},{\"pattern\":\"assert.doesNotReject(asyncFn, [error], [message])\",\"params\":[{\"index\":0,\"name\":\"asyncFn\",\"kind\":\"mandatory\",\"block\":true},{\"index\":1,\"name\":\"error\",\"kind\":\"optional\",\"block\":true},{\"index\":2,\"name\":\"message\",\"kind\":\"optional\",\"message\":true}]}]"), + _pwmeta = (ptnidx, content, filepath, line, extra) => { return Object.assign({ transpiler: "babel-plugin-espower", version: "3.0.1", content, filepath, line }, extra, _pwptn[ptnidx]); }, + _ArgumentRecorder = function () { const isPromiseLike = o => o !== null && typeof o === "object" && typeof o.then === "function" && typeof o.catch === "function"; const mark = (_this, s) => { return function () { const args = Array.from(arguments); _this.status = s; _this.value = args.length === 1 ? args[0] : args; }; }; class $Promise$ { constructor(prms) { this.status = "pending"; prms.then(mark(this, "resolved"), mark(this, "rejected")); } } const wrap = v => isPromiseLike(v) ? new $Promise$(v) : v; class ArgumentRecorder { constructor(callee, am, matchIndex) { this._callee = callee; this._am = am; this._logs = []; this._recorded = null; this._val = null; this._idx = matchIndex; const conf = am.params[matchIndex]; this._isBlock = !!conf.block; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { return this._val; } _tap(value, espath) { this._logs.push({ value: wrap(value), espath }); return value; } _rec(value, espath) { const empowered = this._callee && this._callee._empowered; try { if (!empowered) return value; if (!espath) return this; const log = { value: wrap(value), espath }; this._logs.push(log); if (this._isBlock && empowered && typeof value === "function") { value = new Proxy(value, { apply(target, thisArg, args) { try { const ret = target.apply(thisArg, args); log.value = wrap(ret); return ret; } catch (e) { log.value = e; throw e; } } }); } return this; } finally { if (empowered) { this._recorded = { value, logs: [].concat(this._logs) }; } this._val = value; this._logs = []; } } eject() { const ret = this._recorded; this._recorded = null; this._val = null; return ret; } } return ArgumentRecorder; }(), + _AssertionMessage = function () { const _s = "\n\n "; class AssertionMessage { constructor(am, matchIndex, msgOrRec) { this._am = am; this._idx = matchIndex; this._msgOrRec = msgOrRec; } metadata() { return this._am; } matchIndex() { return this._idx; } val() { if (this._msgOrRec && typeof this._msgOrRec.val === "function") { return this._msgOrRec.val(); } else { return this._msgOrRec; } } eject() { if (this._msgOrRec && typeof this._msgOrRec.eject === "function") { return this._msgOrRec.eject(); } else { return { value: this.val(), logs: [] }; } } toString() { let msg = typeof this._msgOrRec === "string" ? this._msgOrRec : ""; msg += `${_s}# ${this._am.filepath}:${this._am.line}`; msg += `${_s}${this._am.content}`; msg += `${_s}[WARNING] power-assert is not configured. see: https://github.com/power-assert-js/power-assert`; msg += `\n`; return msg; } } return AssertionMessage; }(); var Person, assert; assert = require('power-assert'); @@ -19,15 +22,12 @@ describe("various types", function () { }, NaN, Infinity, /^not/, new Person("alice", 3)]; }); return it("demo", function () { - var _rec = new _powerAssertRecorder(); + var _am = _pwmeta(0, "assert(this.types[index].name === bob.name)", "path/to/coffee_script_test.coffee", 33), + _ag = new _ArgumentRecorder(assert, _am, 0); var bob, index; index = this.types.length - 1; bob = new Person("bob", 5); - return assert(_rec._expr(_rec._capt(_rec._capt(_rec._capt(_rec._capt(this.types, "arguments/0/left/object/object")[_rec._capt(index, "arguments/0/left/object/property")], "arguments/0/left/object").name, "arguments/0/left") === _rec._capt(_rec._capt(bob, "arguments/0/right/object").name, "arguments/0/right"), "arguments/0"), { - content: "assert(this.types[index].name === bob.name)", - filepath: "path/to/coffee_script_test.coffee", - line: 33 - })); + return assert(_ag._rec(_ag._tap(_ag._tap(_ag._tap(this.types, "arguments/0/left/object/object")[_ag._tap(index, "arguments/0/left/object/property")], "arguments/0/left/object").name, "arguments/0/left") === _ag._tap(_ag._tap(bob, "arguments/0/right/object").name, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1)); }); }); diff --git a/test/node-to-be-skipped-test.js b/test/node-to-be-skipped-test.js new file mode 100644 index 0000000..698c939 --- /dev/null +++ b/test/node-to-be-skipped-test.js @@ -0,0 +1,94 @@ +const assert = require('assert'); +const babel = require('@babel/core'); +const espowerPlugin = require('../index'); +const transpile = (code) => { + const result = babel.transform(code, { + filename: '/absolute/path/to/project/test/some_test.js', + plugins: [ + espowerPlugin + ] + }).code; + const lines = result.split('\n'); + const lastLine = lines[lines.length - 1]; + return { + result, + lastLine + }; +}; + +const test = ({input, expected, memo}) => { + const msg = memo || ''; + it (`${input} ${msg}`, () => { + const {lastLine} = transpile(input); + assert.strictEqual(lastLine, expected); + }); +}; + +const tail = (str, n) => { + const lines = str.split('\n'); + return lines.slice(lines.length - n).join('\n'); +}; + +describe(`UnaryExpression`, () => { + test({ + memo: `'typeof Identifier' is not instrumented`, + input: `assert(typeof foo !== 'undefined');`, + expected: `assert(_ag._rec(_ag._tap(typeof foo, "arguments/0/left") !== 'undefined', "arguments/0"), new _AssertionMessage(_am, -1));` + }); + test({ + memo: `'delete Identifier' is not instrumented`, + input: `assert(delete foo.bar);`, + expected: `assert(_ag._rec(delete _ag._tap(_ag._tap(foo, "arguments/0/argument/object").bar, "arguments/0/argument"), "arguments/0"), new _AssertionMessage(_am, -1));` + }); +}); + +describe(`CallExpression`, () => { + test({ + memo: 'Do not instrument non-computed property of MemberExpression within CallExpression.', + input: 'assert(foo.bar());', + expected: 'assert(_ag._rec(_ag._tap(foo, "arguments/0/callee/object").bar(), "arguments/0"), new _AssertionMessage(_am, -1));' + }); + test({ + input: 'assert(foo[bar]());', + expected: 'assert(_ag._rec(_ag._tap(foo, "arguments/0/callee/object")[_ag._tap(bar, "arguments/0/callee/property")](), "arguments/0"), new _AssertionMessage(_am, -1));' + }); +}); + +describe(`UpdateExpression`, () => { + test({ + memo: 'Just wrap UpdateExpression, not digging in.', + input: 'assert(++foo);', + expected: 'assert(_ag._rec(++foo, "arguments/0"), new _AssertionMessage(_am, -1));' + }); +}); + +describe(`ObjectExpression`, () => { + it('Do not instrument shorthanded Object literal value', () => { + const input = 'assert({foo});'; + const expected = 'assert(_ag._rec({\n foo\n}, "arguments/0"), new _AssertionMessage(_am, -1));'; + const {result} = transpile(input); + assert.strictEqual(tail(result, 3), expected); + }); + it('Do not instrument non-computed Object literal key', () => { + const input = 'assert({foo: 3});'; + const expected = 'assert(_ag._rec({\n foo: 3\n}, "arguments/0"), new _AssertionMessage(_am, -1));'; + const {result} = transpile(input); + assert.strictEqual(tail(result, 3), expected); + }); +}); + +describe(`AssignmentExpression`, () => { + test({ + memo: `Do not instrument left due to 'Invalid left-hand side in assignment'`, + input: `assert(counter += n);`, + expected: `assert(_ag._rec(counter += _ag._tap(n, "arguments/0/right"), "arguments/0"), new _AssertionMessage(_am, -1));` + }); +}); + +describe(`ConditionalExpression`, () => { + test({ + memo: 'ConditionalExpression that appears immediately beneath assert', + input: 'assert(foo ? bar : baz);', + expected: 'assert(_ag._rec(_ag._tap(foo, "arguments/0/test") ? _ag._tap(bar, "arguments/0/consequent") : _ag._tap(baz, "arguments/0/alternate")), new _AssertionMessage(_am, -1));' + }); +}); diff --git a/test/recorder_test.js b/test/recorder_test.js index 36985df..af9aedc 100644 --- a/test/recorder_test.js +++ b/test/recorder_test.js @@ -1,62 +1,162 @@ 'use strict'; -var PowerAssertRecorder = require('../lib/power-assert-recorder')(); +var ArgumentRecorder = require('../lib/argument-recorder')(); + var assert = require('assert'); -describe('power-assert-recorder', function () { - var foo = 'FOO'; +function willResolve (value) { + return new Promise(function (resolve, reject) { + setTimeout(function () { + resolve(value); + }, 10); + }); +} + +var am = { + pattern: 'assert(value, [message])', + params: [ + { + name: 'value', + index: 0, + kind: 'mandatory' + }, + { + name: 'message', + index: 1, + kind: 'optional', + message: true + } + ] +}; - it('_capt', function () { - var _rec = new PowerAssertRecorder(); - var identVal = _rec._capt(foo, 'arguments/0'); - assert.equal(identVal, 'FOO'); +describe('to-be-embedded argument-recorder', function () { + var foo, _ar, fakeCallee = function () {}; + beforeEach(function () { + foo = 'FOO'; + fakeCallee._empowered = true; + _ar = new ArgumentRecorder(fakeCallee, am, 1); + }); + afterEach(function () { + fakeCallee._empowered = true; }); - it('_expr', function () { - var _rec = new PowerAssertRecorder(); - var capturedExpr = _rec._expr(_rec._capt(foo, 'arguments/0'), { - content: 'assert(foo)', - filepath: 'path/to/some_test.js', - line: 1 - }); - assert.deepEqual(capturedExpr, { - powerAssertContext: { - events: [ + describe('#_tap(value, espath)', function () { + it('returns argument untouched', function () { + var ret = _ar._tap(foo, 'arguments/0'); + assert(ret === foo); + }); + it('tapped value is not modified', function () { + var ret = _ar._tap(foo, 'arguments/0'); + assert.equal(ret, 'FOO'); + }); + }); + + describe('#val()', function () { + it('returns null if not recorded yet', function () { + assert.equal(_ar.val(), null); + }); + it('returns recorded actual value of target argument', function () { + _ar._rec(_ar._tap(foo, 'arguments/0')); + assert.equal(_ar.val(), 'FOO'); + }); + }); + + describe('#_rec(value, [espath])', function () { + describe('when runtime exists', function () { + beforeEach(function () { + fakeCallee._empowered = true; + }); + it('returns self if runtime exists', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert(ret === _ar); + }); + it('once called, argument value is stored', function () { + _ar._rec(foo, 'arguments/0'); + assert.equal(_ar.val(), 'FOO'); + }); + describe('when espath argument exists', function () { + it('record value', function () { + _ar._rec(foo, 'arguments/0'); + assert.deepEqual(_ar.eject(), { + logs: [ + { + espath: "arguments/0", + value: "FOO" + } + ], + value: "FOO" + }); + }); + }); + describe('when espath argument does not exist', function () { + it('skip recording value', function () { + _ar._rec(foo); + assert.deepEqual(_ar.eject(), { + logs: [], + value: "FOO" + }); + }); + }); + }); + describe('when runtime does not exist', function () { + beforeEach(function () { + fakeCallee._empowered = false; + }); + it('returns value untouched', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert.equal(ret, 'FOO'); + }); + it('once called, argument value is stored', function () { + _ar._rec(foo, 'arguments/0'); + assert.equal(_ar.val(), 'FOO'); + }); + it('does not record value', function () { + _ar._rec(foo, 'arguments/0'); + assert.strictEqual(_ar.eject(), null); + }); + }); + }); + + describe('#eject()', function () { + beforeEach(function () { + _ar._rec(foo, 'arguments/0'); + assert.equal(_ar.val(), 'FOO'); + }); + it('returns recorded values and its metadata', function () { + var recordedData = _ar.eject(); + assert.deepEqual(recordedData, { + logs: [ { espath: "arguments/0", value: "FOO" } ], value: "FOO" - }, - source: { - content: "assert(foo)", - filepath: "path/to/some_test.js", - line: 1 - } + }); }); - }); - - it('for asserting loop invariants, recorder should clean up captured values at the end of expression', function () { - var incr = (function () { - var cnt = 0; - return function () { - return ++cnt; + it('clears stored argument value', function () { + _ar.eject(); + assert.equal(_ar.val(), null); + }); + it('for asserting loop invariants, recorder should clean up captured values at the end of expression', function () { + var incr = (function () { + var cnt = 0; + return function () { + return ++cnt; + }; + })(); + var fakeCallee = function () { }; - })(); - var _rec = new PowerAssertRecorder(); - var actual = []; - for (var i = 0; i < 3; i += 1) { - actual.push(_rec._expr(_rec._capt(incr(), 'arguments/0'), { - content: 'assert(incr())', - filepath: 'path/to/some_test.js', - line: 1 - })); - } - assert.deepEqual(actual, [ - { - powerAssertContext: { - events: [ + fakeCallee._empowered = true; + var _ar = new ArgumentRecorder(fakeCallee, am, 1); + var actualRecordedData = []; + for (var i = 0; i < 3; i += 1) { + _ar._rec(incr(), 'arguments/0'); + actualRecordedData.push(_ar.eject()); + } + assert.deepEqual(actualRecordedData, [ + { + logs: [ { espath: "arguments/0", value: 1 @@ -64,15 +164,8 @@ describe('power-assert-recorder', function () { ], value: 1 }, - source: { - content: "assert(incr())", - filepath: "path/to/some_test.js", - line: 1 - } - }, - { - powerAssertContext: { - events: [ + { + logs: [ { espath: "arguments/0", value: 2 @@ -80,29 +173,111 @@ describe('power-assert-recorder', function () { ], value: 2 }, - source: { - content: "assert(incr())", - filepath: "path/to/some_test.js", - line: 1 - } - }, - { - powerAssertContext: { - events: [ + { + logs: [ { espath: "arguments/0", value: 3 } ], value: 3 - }, - source: { - content: "assert(incr())", - filepath: "path/to/some_test.js", - line: 1 } - } - ]); + ]); + }); + }); + + describe('when value is a Promise', function () { + beforeEach(function () { + foo = willResolve('future'); + }); + describe('when runtime exists', function () { + beforeEach(function () { + fakeCallee._empowered = true; + }); + it('_rec(value, [espath]) returns self', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert(ret === _ar); + }); + it('return value of _tap(value, espath) is still untouched', function () { + var ret = _ar._tap(foo, 'arguments/0'); + assert(ret === foo); + }); + it('return value of val() is still untouched', function () { + _ar._rec(foo, 'arguments/0'); + assert(_ar.val() === foo); + }); + it('Promises in recorded logs are wrapped', function () { + _ar._rec(foo, 'arguments/0'); + var recordedData = _ar.eject(); + assert.strictEqual(recordedData.value, foo, 'return value is untouched'); + var wrapped = recordedData.logs[0].value; + assert.notStrictEqual(wrapped, foo, 'Promises in logs are wrapped'); + }); + it('store Promise status and callback value when settled', function (done) { + _ar._rec(foo, 'arguments/0'); + var recordedData = _ar.eject(); + var wrapped = recordedData.logs[0].value; + assert(wrapped.status === 'pending'); + assert(wrapped.value === undefined); + foo.then(function (_) { + assert.equal(wrapped.status, 'resolved'); + assert.equal(wrapped.value, 'future'); + done(); + }); + }); + }); + describe('when runtime does not exist', function () { + beforeEach(function () { + fakeCallee._empowered = false; + }); + it('return value of _rec(value, [espath]) is still untouched', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert(ret === foo); + }); + it('return value of _tap(value, espath) is still untouched', function () { + var ret = _ar._tap(foo, 'arguments/0'); + assert(ret === foo); + }); + it('return value of val() is still untouched', function () { + _ar._rec(foo, 'arguments/0'); + assert(_ar.val() === foo); + }); + }); + + }); + + describe('when value is a function', function () { + beforeEach(function () { + foo = function () { return 'FUNC'; }; + }); + describe('when runtime exists', function () { + beforeEach(function () { + fakeCallee._empowered = true; + }); + it('_rec(value, [espath]) returns self', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert.equal(ret, _ar); + }); + }); + describe('when runtime does not exist', function () { + beforeEach(function () { + fakeCallee._empowered = false; + }); + it('return value of _tap(value, espath) is untouched', function () { + var ret = _ar._tap(foo, 'arguments/0'); + assert(ret === foo); + assert(typeof ret === 'function'); + }); + it('return value of _rec(value, [espath]) is untouched', function () { + var ret = _ar._rec(foo, 'arguments/0'); + assert(ret === foo); + }); + it('return value of val() is untouched', function () { + _ar._rec(foo, 'arguments/0'); + assert(_ar.val() === foo); + assert(typeof _ar.val() === 'function'); + }); + }); }); }); diff --git a/test/unit_test.js b/test/unit_test.js new file mode 100644 index 0000000..0a09b1b --- /dev/null +++ b/test/unit_test.js @@ -0,0 +1,78 @@ +const assert = require('assert'); +const babel = require('@babel/core'); +const espowerPlugin = require('../index'); +const transpile = (code) => { + const result = babel.transform(code, { + filename: '/absolute/path/to/project/test/some_test.js', + plugins: [ + espowerPlugin + ] + }).code; + const lines = result.split('\n'); + const lastLine = lines[lines.length - 1]; + return { + result, + lastLine + }; +}; + +describe('simple Identifier: assert(falsy)', () => { + const input = ` +const falsy = false; +assert(falsy); +`; + it('AssertionMetadata', () => { + const expected = `_am = _pwmeta(0, "assert(falsy)", "some_test.js", 3)`; + const {result} = transpile(input); + assert(result.indexOf(expected) !== -1); + }); + it ('ArgumentRecorder', () => { + const {result} = transpile(input); + assert(result.indexOf('_ag = new _ArgumentRecorder(assert, _am, 0)') !== -1); + }); + it ('AssertionMessage', () => { + const {lastLine} = transpile(input); + assert.strictEqual(lastLine, 'assert(_ag._rec(falsy, "arguments/0"), new _AssertionMessage(_am, -1));'); + }); +}); + +describe('assertion message of string literal: assert(falsy, "assertion message")', () => { + const input = ` +const falsy = false; +assert(falsy, "assertion message"); +`; + it('AssertionMetadata', () => { + const expected = `_am = _pwmeta(0, "assert(falsy, \\"assertion message\\")", "some_test.js", 3)`; + const {result} = transpile(input); + assert(result.indexOf(expected) !== -1); + }); + it ('ArgumentRecorder', () => { + const {result} = transpile(input); + assert(result.indexOf('_ag = new _ArgumentRecorder(assert, _am, 0)') !== -1); + }); + it ('AssertionMessage', () => { + const {lastLine} = transpile(input); + assert.strictEqual(lastLine, 'assert(_ag._rec(falsy, "arguments/0"), new _AssertionMessage(_am, 1, "assertion message"));'); + }); +}); + +describe('assertion message of some expression: assert(falsy, msg)', () => { + const input = ` +const falsy = false; +const msg = 'assertion message'; +assert(falsy, msg); +`; + it('AssertionMetadata', () => { + const expected = `_am = _pwmeta(0, "assert(falsy, msg)", "some_test.js", 4)`; + const {result} = transpile(input); + assert(result.indexOf(expected) !== -1); + }); + it ('ArgumentRecorder', () => { + const {result} = transpile(input); + assert(result.indexOf('_ag = new _ArgumentRecorder(assert, _am, 0)') !== -1); + }); + it ('AssertionMessage', () => { + const {lastLine} = transpile(input); + assert.strictEqual(lastLine, 'assert(_ag._rec(falsy, "arguments/0"), new _AssertionMessage(_am, 1, _ag2._rec(msg, "arguments/1")));'); + }); +});