Detalhes do pacote

power-assert-context-reducer-ast

twada691.3kMIT1.2.0

append AST into power-assert context

power-assert

readme (leia-me)

power-assert

Build Status NPM version License

powerAssertContext reducer function to parse assertion expression at runtime.

Use this function when transpiler side does not add ast, tokens and visitorKeys at compile time.

API

var appendAst = require('power-assert-context-reducer-ast');

var appendedContext = appendAst(powerAssertContext);

Given powerAssertContext object, having structure below but does not have ast, tokens and visitorKeys, append them to output context.

input:

{
    source: {
        content: 'assert(foo === bar)',
        filepath: 'test/some_test.js',
        line: 1
    },
    args: [
        {
            value: false,
            events: [
                {
                    value: "FOO",
                    espath: "arguments/0/left"
                },
                {
                    value: "BAR",
                    espath: "arguments/0/right"
                },
                {
                    value: false,
                    espath: "arguments/0"
                }
            ]
        }
    ]
}

output:

{
    source: {
        content: 'assert(foo === bar)',
        filepath: 'test/some_test.js',
        line: 1,
        ast: '### JSON representation of AST nodes ###',
        tokens: '### JSON representation of AST tokens ###',
        visitorKeys: '### JSON representation of AST visitor keys ###'
    },
    args: [
        {
            value: false,
            events: [
                {
                    value: "FOO",
                    espath: "arguments/0/left"
                },
                {
                    value: "BAR",
                    espath: "arguments/0/right"
                },
                {
                    value: false,
                    espath: "arguments/0"
                }
            ]
        }
    ]
}

INSTALL

$ npm install --save-dev power-assert-context-reducer-ast

AUTHOR

CONTRIBUTORS

LICENSE

Licensed under the MIT license.

changelog (log de mudanças)

1.2.0 (2018-06-12)

Features

Breaking Changes

1.1.2 (2017-04-14)

Bug Fixes

1.1.1 (2016-11-10)

Chore

  • power-assert-context-reducer-ast: upgrade acorn to ^4.0.0

1.1.0 (2016-10-07)

Features

Chore

1.0.7 (2016-07-01)

Bug Fixes

1.0.6 (2016-06-05)

Bug Fixes

  • power-assert-renderer-diagram: fix custom function interop (34565f9)
  • power-assert-renderer-comparison: fix custom function interop (0145182)

1.0.5 (2016-06-05)

Bug Fixes

  • export support functions for older implementations (6927774)

1.0.4 (2016-06-04)

Bug Fixes

  • power-assert-context-formatter: re-introduce legacy renderer compatibility layer (d93c2dd)

1.0.3 (2016-06-01)

Bug Fixes

  • power-assert-context-formatter: remove unnecessary legacy compatibility (cfb5fe0)

1.0.2 (2016-06-01)

Bug Fixes

  • power-assert-context-formatter: introduce legacy formatter compatibility layer (8a497958)
  • power-assert-context-reducer-ast: skip already visited node to prevent error (30419c6d)

1.0.1 (2016-05-31)

Bug Fixes

  • power-assert-runtime: update 0.1.0 refs to 1.0.0 (dc18466)

1.0.0 (2016-05-31)

Features

0.1.0 (2016-04-07)

Features

  • initial release