Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

espower-loader

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

espower-loader

Power Assert feature instrumentor on the fly

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
decreased by-4.24%
Maintainers
1
Weekly downloads
 
Created
Source

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.

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,gulp-espower, and so on).

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])',
            'assert.deepStrictEqual(actual, expected, [message])',
            'assert.notDeepStrictEqual(actual, expected, [message])'
        ]
    }
});

CHANGELOG

See CHANGELOG

AUTHOR

LICENSE

Licensed under the MIT license.

Keywords

FAQs

Package last updated on 30 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc