1 | # gulp-espower [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]
|
2 |
|
3 | > A [gulp](https://github.com/wearefractal/gulp) plugin for [power-assert](http://github.com/twada/power-assert).
|
4 |
|
5 | ## Description
|
6 | `gulp-espower` is a gulp plugin to instrument "Power Assert" feature into your code.
|
7 |
|
8 |
|
9 | Internally, `gulp-espower` task uses `espower` module that manipulates assertion expression (JavaScript Code) represented as [Mozilla JavaScript AST](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API), to instrument power-assert feature into the code. The magic is done by using [Esprima](http://esprima.org/) and [Escodegen](https://github.com/Constellation/escodegen).
|
10 |
|
11 |
|
12 | Please note that `gulp-espower` is a beta version product. Pull-requests, issue reports and patches are always welcomed. See [power-assert](http://github.com/twada/power-assert) project for more documentation.
|
13 |
|
14 |
|
15 | ## Usage
|
16 |
|
17 | First, install `gulp-espower` as a development dependency:
|
18 |
|
19 | ```shell
|
20 | npm install --save-dev gulp-espower
|
21 | ```
|
22 |
|
23 | Then, add it to your `gulpfile.js`:
|
24 |
|
25 | ```javascript
|
26 | var espower = require("gulp-espower");
|
27 |
|
28 | gulp.src("./test/*.js")
|
29 | .pipe(espower())
|
30 | .pipe(gulp.dest("./dist"));
|
31 | ```
|
32 |
|
33 | ## API
|
34 |
|
35 | ### espower(options)
|
36 |
|
37 | #### options.powerAssertVariableName
|
38 | Type: `String`
|
39 | Default value: `'assert'`
|
40 |
|
41 | Target variable name to instrument.
|
42 |
|
43 | #### options.lineSeparator
|
44 | Type: `String`
|
45 | Default value: `'\n'`
|
46 |
|
47 | Line separator in target sources.
|
48 |
|
49 | #### options.targetMethods
|
50 | Type: `Object`
|
51 | Default value:
|
52 |
|
53 | ```javascript
|
54 | targetMethods: {
|
55 | oneArg: [
|
56 | 'ok'
|
57 | ],
|
58 | twoArgs: [
|
59 | 'equal',
|
60 | 'notEqual',
|
61 | 'strictEqual',
|
62 | 'notStrictEqual',
|
63 | 'deepEqual',
|
64 | 'notDeepEqual'
|
65 | ]
|
66 | }
|
67 | ```
|
68 |
|
69 | Target assertion methods to insrtument.
|
70 |
|
71 | * `oneArg` array for assertion methods with a expression argument (like `assert.ok(actual)`)
|
72 | * `twoArgs` array for assertion methods with two expression arguments (like `assert.equal(actual, expected)`)
|
73 |
|
74 |
|
75 | ## License
|
76 |
|
77 | Licensed under the [MIT](https://raw.github.com/twada/gulp-espower/master/LICENSE-MIT) license.
|
78 |
|
79 | [npm-url]: https://npmjs.org/package/gulp-espower
|
80 | [npm-image]: https://badge.fury.io/js/gulp-espower.svg
|
81 |
|
82 | [travis-url]: http://travis-ci.org/twada/gulp-espower
|
83 | [travis-image]: https://secure.travis-ci.org/twada/gulp-espower.svg?branch=master
|
84 |
|
85 | [depstat-url]: https://gemnasium.com/twada/gulp-espower
|
86 | [depstat-image]: https://gemnasium.com/twada/gulp-espower.svg
|