# espower-loader

> Power Assert feature instrumentor on the fly

Latest version **1.2.2** (published 2017-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install espower-loader
pnpm add espower-loader
yarn add espower-loader
bun add espower-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2017-04-24 |
| First published | 2013-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Takuto Wada |
| Maintainers | twada |
| Keywords | power-assert, assert, assertion, test, testing |

## Links

- npm: https://www.npmjs.com/package/espower-loader
- Repository: https://github.com/power-assert-js/espower-loader
- Issues: https://github.com/power-assert-js/espower-loader/issues
- npm.io page: https://npm.io/package/espower-loader

## Dependencies (5)

- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.0
- [espower-source](https://npm.io/package/espower-source.md) ^2.0.0
- [convert-source-map](https://npm.io/package/convert-source-map.md) ^1.1.0
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.4.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2017-04-24
- 1.2.1 — 2017-04-09
- 1.2.0 — 2016-11-13
- 1.1.0 — 2016-11-12
- 1.0.1 — 2016-07-30
- 1.0.0 — 2015-08-21
- 0.11.0 — 2015-05-06
- 0.10.0 — 2014-11-11
- 0.9.1 — 2014-09-17
- 0.9.0 — 2014-09-02
- 0.8.0 — 2014-08-12
- 0.7.1 — 2014-05-20
- 0.7.0 — 2014-05-12
- 0.6.0 — 2014-04-10
- 0.5.0 — 2014-04-04
- … 6 more at https://npm.io/package/espower-loader/versions

## README

espower-loader
================================

[![Build Status][travis-image]][travis-url]
[![NPM package][npm-image]][npm-url]
[![Dependency Status][depstat-image]][depstat-url]

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](https://github.com/power-assert-js/espower) to target sources on loading them. `espower` manipulates assertion expression (JavaScript Code) in the form of ECMAScript AST defined in [The ESTree Spec](https://github.com/estree/estree) (formerly known as [Mozilla SpiderMonkey Parser API](https://developer.mozilla.org/en-US/docs/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](https://github.com/evanw/node-source-map-support) module.

Pull-requests, issue reports and patches are always welcomed. See [power-assert](https://github.com/power-assert-js/power-assert) project for more documentation.


FYI: You may be interested in [intelli-espower-loader](https://github.com/power-assert-js/intelli-espower-loader) to go one step further. With [intelli-espower-loader](https://github.com/power-assert-js/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,

```javascript
require('espower-loader')({
    pattern: '{src,test}/**/*.js'
});
```

You can specify options for `espower` module explicitly.

```javascript
require('espower-loader')({

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

    // glob pattern using minimatch module
    pattern: '{src,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])'
        ]
    }
});
```


OUR SUPPORT POLICY
---------------------------------------

We support Node under maintenance. In other words, we stop supporting old Node version when [their maintenance ends](https://github.com/nodejs/LTS).

This means that any other environment is not supported.

NOTE: If espower-source works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk.


CHANGELOG
---------------------------------------
See [CHANGELOG](https://github.com/power-assert-js/espower-loader/blob/master/CHANGELOG.md)


AUTHOR
---------------------------------------
* [Takuto Wada](https://github.com/twada)


CONTRIBUTORS
---------------------------------------
* [Eward Song (shepherdwind)](https://github.com/shepherdwind)
* [Haoliang Gao (popomore)](https://github.com/popomore)


LICENSE
---------------------------------------
Licensed under the [MIT](https://github.com/power-assert-js/espower-loader/blob/master/MIT-LICENSE.txt) license.


[npm-url]: https://npmjs.org/package/espower-loader
[npm-image]: https://badge.fury.io/js/espower-loader.svg

[travis-url]: https://travis-ci.org/power-assert-js/espower-loader
[travis-image]: https://secure.travis-ci.org/power-assert-js/espower-loader.svg?branch=master

[depstat-url]: https://gemnasium.com/power-assert-js/espower-loader
[depstat-image]: https://gemnasium.com/power-assert-js/espower-loader.svg

---
_Source: https://npm.io/package/espower-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
