Skip to content

Commit

Permalink
Upgrade node engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Taka Okunishi committed May 14, 2016
1 parent 939ee50 commit ecf0e77
Show file tree
Hide file tree
Showing 19 changed files with 240 additions and 349 deletions.
33 changes: 17 additions & 16 deletions .README.md.bud
Expand Up @@ -2,25 +2,26 @@
* Bud file for README.md
*/

"use strict";
'use strict'

var apeTmpl = require('ape-tmpl'),
pkg = require('./package.json');
const apeTmpl = require('ape-tmpl');
const pkg = require('./package.json')

module.exports = apeTmpl.readmeMdBud({
pkg: pkg,
repo: 'okunishinishi/node-' + pkg.name,
sections: 'docs/readme/*.md.hbs',
badges: {
travis: true,
codeclimate: true,
codeclimateCoverage: true,
gemnasium: false,
npm: true
},
links: null
});
pkg: pkg,
repo: pkg.repository,
sections: 'docs/guides/*.md.hbs',
badges: {
travis: true,
codeclimate: true,
codeclimateCoverage: true,
gemnasium: false,
npm: true,
standard: true
},
links: null
})

if (!module.parent) {
require('coz').render(__filename);
require('coz').render(__filename)
}
11 changes: 5 additions & 6 deletions .travis.yml
@@ -1,15 +1,14 @@
language: node_js
node_js:
- '0.11'
- '6'
before_install:
- npm install mocha istanbul -g
install:
- npm install
before_script:
- npm link .
script:
- npm run test
- npm run cover
- npm run report
- ./ci/test.js
- ./ci/cover.js
- ./ci/report.js
env:
global:
- secure: G9E09sbh0+ZqhMRgJC9MuTOUN7/SwnWQPlRBVdx1RW4FmP6bWQGEmWLxJFwXjeM8JZhmue98oYMxVHHYoWwqPYypEsdO9hE8tenjAkpKChgiEGFheHpEPPDNTRhARBGJXSil1SQMlnflOWTbY7czAeGj0DOGRpA/jis3zNTO3ks1T8ZdfTVmfXzt1v+4Xmz3ipGCqj9C9ksPhjP2Sv+anR6Y6exbDYFC7QmnNBqspu6RPGP8nBsdbtAkNQLssNoD9MsM8+9h3+UC1tejwGdgfSj8oDfSch0qnfI81Yk4M67AXBcYg/buhVZABVln3dPxFishfY4qK4x7PAAtJR3ME04meke6gn5BmOUuehmerP6MCAtzWfwBWG2hIsb3masmlNJZdDBtsTs6L415Xrb5DvimIAHAgoBsN2XDLgO0o2Cx5CY5JcDYg29YwGsLr6kshD7cBlHSySca9tYdVGuxeLJxUtuTrPQD0NVPl7jf/IWZ3PA3qEGIGbFdXFCl+Q2yWcxOYpqb2+06mfY7yeWUHdIsEi/7feTL7ri1yXPb1ZIE+DgA2SpDOjj/0Zwfh45EU3CqxOsGTBUzwKGQOW/eloMUWcJ6KNUnW4uh+qbOqMRUJf6mW86RUo1XLlUaFaBamFs5lbTXuheaCCMbFBa/LqX/mqO5aOZp2UYVUyGLNt8=
112 changes: 7 additions & 105 deletions README.md
@@ -1,13 +1,18 @@
injectmock
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/okunishinishi/node-injectmock
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-injectmock
Expand All @@ -20,6 +25,8 @@ injectmock
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-injectmock.svg
[bd_npm_url]: http://www.npmjs.org/package/injectmock
[bd_npm_shield_url]: http://img.shields.io/npm/v/injectmock.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->

Expand All @@ -37,111 +44,6 @@ Inject mock and restore original for javascript property. Useful for unit testi
<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "docs/readme/01.Installation.md.hbs" Start -->

<a name="section-docs-readme-01-installation-md"></a>
Installation
-----

```bash
npm install injectmock --save-dev
```

<!-- Section from "docs/readme/01.Installation.md.hbs" End -->

<!-- Section from "docs/readme/02.Usage.md.hbs" Start -->

<a name="section-docs-readme-02-usage-md"></a>
Usage
----

Injecting mock:

```javascript
var injectmock = require('injectmock');
injectmock(myModule, 'myFunction', myMockFunction);
```

Restoring Original:

```javascript
injectmock.restoreAll();
```

<!-- Section from "docs/readme/02.Usage.md.hbs" End -->

<!-- Section from "docs/readme/03.Examples.md.hbs" Start -->

<a name="section-docs-readme-03-examples-md"></a>
Examples
-----

Work with nodeunit setUp/tearDown method:

```javascript
/**
* This an example inject mock for nodeunit test.
*/

var injectmock = require('injectmock');

// Disable console.log before test started.
exports.setUp = function (done) {
function mockLog() {
}

// Inject `mockLog` as `console.log`.
injectmock(console, 'log', mockLog);

done();
};

// Disable console.log before test done.
exports.tearDown = function (done) {
// Restore all injected.
injectmock.restoreAll();

console.log('Now I am back!');

done();
};

```

<!-- Section from "docs/readme/03.Examples.md.hbs" End -->

<!-- Section from "docs/readme/04.API.md.hbs" Start -->

<a name="section-docs-readme-04-a-p-i-md"></a>
API Guide
-----

#### `injectmock(module, key, value)`

Inject a mock to module.


#### `injectmock.restore(module, key)`

Restore an injected.


#### `injectmock.restoreAll()`

Restore all injected.


#### `injectmock.new()`

Returns a new `injectmock` context, which has separated mock stacks.


#### `injectmock.noop()`

Do nothing. You can use this method as mock to do nothing.

<!-- Section from "docs/readme/04.API.md.hbs" End -->


<!-- Sections Start -->

Expand Down
18 changes: 8 additions & 10 deletions ci/build.js
Expand Up @@ -4,18 +4,16 @@
* Build this project.
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
coz = require('coz');
const apeTasking = require('ape-tasking')
const coz = require('coz')

apeTasking.runTasks('build', [
function (callback) {
coz.render([
'.*.bud'
], callback);
}
], true);
() => coz.render([
'.*.bud'
])
], true)

21 changes: 9 additions & 12 deletions ci/cover.js
Expand Up @@ -4,19 +4,16 @@
* Run coverage.
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
apeCovering = require('ape-covering');
const apeTasking = require('ape-tasking')
const apeCovering = require('ape-covering')

apeTasking.runTasks('cover', [
function (callback) {
apeCovering.measureCoverage(
require.resolve('./test.js'), [], {
dir: 'coverage'
}, callback
);
}
], true);
() => apeCovering.measureCoverage(
'_mocha', [ '*_test.js' ], {
dir: 'coverage'
})
], true)
24 changes: 11 additions & 13 deletions ci/release.js
Expand Up @@ -4,20 +4,18 @@
* Release this package.
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
apeReleasing = require('ape-releasing');
const apeTasking = require('ape-tasking')
const apeReleasing = require('ape-releasing')

apeTasking.runTasks('release', [
function (callback) {
apeReleasing.releasePackage({
beforeRelease: [
'ci/build.js',
'ci/test.js'
]
}, callback);
}
], true);
() => apeReleasing.releasePackage({
beforeRelease: [
'ci/build.js',
'ci/test.js'
]
})
], true)
14 changes: 6 additions & 8 deletions ci/report.js
Expand Up @@ -4,15 +4,13 @@
* Run report
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
apeReporting = require('ape-reporting');
const apeTasking = require('ape-tasking')
const apeReporting = require('ape-reporting');

apeTasking.runTasks([
function (callback) {
apeReporting.sendToCodeclimate('coverage/lcov.info', callback);
}
], true);
() => apeReporting.sendToCodeclimate('coverage/lcov.info')
], true)
14 changes: 6 additions & 8 deletions ci/test.js
Expand Up @@ -4,15 +4,13 @@
* Run test
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
apeTesting = require('ape-testing');
const apeTasking = require('ape-tasking')
const apeTesting = require('ape-testing')

apeTasking.runTasks('test', [
function (callback) {
apeTesting.runNodeunit('*_test.js', callback);
}
], true);
() => apeTesting.runMocha('*_test.js', {})
], true)
12 changes: 6 additions & 6 deletions ci/update.js
Expand Up @@ -4,15 +4,15 @@
* Update project.
*/

"use strict";
'use strict'

process.chdir(__dirname + '/..');
process.chdir(`${__dirname}/..`)

var apeTasking = require('ape-tasking'),
apeUpdating = require('ape-updating');
const apeTasking = require('ape-tasking'),
apeUpdating = require('ape-updating')

apeTasking.runTasks('update', [
function renderBud(callback) {
apeUpdating.updateDependencies({}, callback);
apeUpdating.updateDependencies({}, callback)
}
], true);
], true)
File renamed without changes.
15 changes: 15 additions & 0 deletions doc/guides/02.Usage.md.hbs
@@ -0,0 +1,15 @@
Usage
----
Injecting mock:
```javascript
const injectmock = require('injectmock')
injectmock(myModule, 'myFunction', myMockFunction)
```
Restoring Original:
```javascript
injectmock.restoreAll()
```
Expand Up @@ -4,5 +4,5 @@ Examples
Work with nodeunit setUp/tearDown method:
```javascript
{{{read 'docs/examples/example-nodeunit.js'}}}
{{{read 'example/example-nodeunit.js'}}}
```
File renamed without changes.

0 comments on commit ecf0e77

Please sign in to comment.