GithubHelp home page GithubHelp logo

sanemat / espower-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from power-assert-js/espower-loader

0.0 2.0 0.0 129 KB

Power Assert feature instrumentor on the fly

License: MIT License

JavaScript 100.00%

espower-loader's Introduction

espower-loader

Build Status NPM package Dependency Status

Power Assert feature instrumentor on the fly.

DESCRIPTION

espower-loader is a Node.js module loader that enhances target sources on the fly. So you can instrument Power Assert feature without code generation for now.

espower-loader applies espower to target sources on loading them. espower manipulates assertion expression (JavaScript Code) in the form of ECMAScript AST defined in The ESTree Spec (formerly known as Mozilla SpiderMonkey Parser API), to instrument power-assert feature into the code. espower-loader also adjusts line and column number in stack traces by using source-map-support module.

Please note that espower-loader is a beta version product. Pull-requests, issue reports and patches are always welcomed. See power-assert project for more documentation.

FYI: You may be interested in intelli-espower-loader to go one step further. With intelli-espower-loader, you don't need to create loader file (like enable-power-assert.js). Just define test directory in package.json wow!

EXAMPLE

You can instrument power-assert without code generation (e.g. without using grunt-espower).

For mocha, Just add --require option.

$ mocha --require ./path/to/enable-power-assert test/some_test_using_powerassert.js

where enable-power-assert.js somewhere in your project is,

require('espower-loader')({
    cwd: process.cwd(),
    pattern: 'test/**/*.js'
});

You can specify options for espower module explicitly.

require('espower-loader')({

    // directory where match starts with
    cwd: process.cwd(),

    // glob pattern using minimatch module
    pattern: 'test/**/*.js',

    // options for espower module
    espowerOptions: {
        patterns: [
            'assert(value, [message])',
            'assert.ok(value, [message])',
            'assert.equal(actual, expected, [message])',
            'assert.notEqual(actual, expected, [message])',
            'assert.strictEqual(actual, expected, [message])',
            'assert.notStrictEqual(actual, expected, [message])',
            'assert.deepEqual(actual, expected, [message])',
            'assert.notDeepEqual(actual, expected, [message])'
        ]
    }
});

CHANGELOG

See CHANGELOG

AUTHOR

LICENSE

Licensed under the MIT license.

espower-loader's People

Contributors

twada avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.