Skip to content

Commit

Permalink
Coveralls (#17)
Browse files Browse the repository at this point in the history
* 馃惐馃懁

* improve coverage

* pipe it

* try again

* can into master

* bump
  • Loading branch information
big-kahuna-burger committed Apr 1, 2017
1 parent 7eed221 commit 27bcb91
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,6 @@
# Jetbrains WebStorm
.idea

.nyc_output
# Logs
logs
*.log
Expand Down
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -3,13 +3,21 @@
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]
[![Package Quality][pack-quality-svg]][pack-quality-url]
[![Coverage Status][coveralls-svg-branch]][coveralls-branch]



[npm-image]: https://img.shields.io/npm/v/tape-nock.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/tape-nock
[travis-image]: https://img.shields.io/travis/Flet/tape-nock.svg?style=flat-square
[travis-url]: https://travis-ci.org/Flet/tape-nock
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
[pack-quality-url]: http://packagequality.com/#?package=tape-nock
[pack-quality-svg]: http://npm.packagequality.com/shield/tape-nock.svg
[coveralls-svg-branch]: https://coveralls.io/repos/github/Flet/tape-nock/badge.svg?branch=master
[coveralls-branch]: https://coveralls.io/github/Flet/tape-nock?branch=master

Automatically record and playback HTTP calls for each tape test. This package is really just a decorator that wraps each test individual test with nock's [Nock Back](https://github.com/pgte/nock#nock-back) feature. This helps avoid the all `nockBack` wrapping code which can make tests less clear.

Expand Down
21 changes: 17 additions & 4 deletions package.json
@@ -1,12 +1,14 @@
{
"name": "tape-nock",
"description": "Automatically record and playback HTTP calls for each tape test.",
"version": "1.5.0",
"version": "1.5.1",
"author": "Dan Flettre <fletd01@yahoo.com>",
"bugs": {
"url": "https://github.com/Flet/tape-nock/issues"
},
"devDependencies": {
"coveralls": "^2.13.0",
"nyc": "^10.2.0",
"request": "^2.69.0",
"standard": "*",
"tap-spec": "^4.0.2",
Expand All @@ -29,9 +31,12 @@
"url": "https://github.com/Flet/tape-nock.git"
},
"scripts": {
"test": "npm run test:generic && npm run test:only && standard",
"oldTest": "npm run test:generic && npm run test:only && standard",
"test:generic": "tape test/*.js | tap-spec",
"test:only": "tape test/only/*.js | tap-spec"
"test:only": "tape test/only/*.js | tap-spec",
"test:generic:n": "nyc tape test/*.js",
"test:only:n": "tape test/only/*.js",
"test": "npm run test:generic:n && npm run test:only:n && nyc report --reporter=text-lcov | coveralls"
},
"dependencies": {
"@types/nock": "^0.54.30",
Expand All @@ -42,5 +47,13 @@
"contributors": [
"Arandjel Sarenac <arandjel.sarenac@gmail.com>"
],
"typings": "index.d.ts"
"typings": "index.d.ts",
"config": {
"nyc": {
"exclude": [
"node_modules/**",
"test/**"
]
}
}
}
11 changes: 9 additions & 2 deletions test/index.js
Expand Up @@ -25,6 +25,13 @@ test('get clockmoji - live', function (t) {
}
})

test('duplicate test name throws', function (t) {
t.throws(function () {
test('get clockmoji - live', function () {})
}, 'should throw')
t.end()
})

test('get clockmoji - fixture with modified name', function (t) {
request.get('http://registry.npmjs.org/clockmoji', process)

Expand All @@ -39,7 +46,7 @@ var after = function (scope) {
scope.filteringPath(/secrets=[^&]*/g, 'secrets=shh')
}

test('pass through opts to nockback', {after: after}, function (t) {
test('pass through opts to nockback', { after: after }, function (t) {
request.get('http://registry.npmjs.com?secrets=omg-secrets', function (err, resp) {
t.error(err)
t.equals(JSON.parse(resp.body).haha, 'no secrets for you', 'secrets are protected')
Expand All @@ -50,7 +57,7 @@ test('pass through opts to nockback', {after: after}, function (t) {
test('able to get a copy of nock from test.nock and use it', function (t) {
var nock = test.nock

nock('http://registry.npmjs.org').get('/clockmoji').reply(200, {'yep': 'it works'})
nock('http://registry.npmjs.org').get('/clockmoji').reply(200, { 'yep': 'it works' })

request.get('http://registry.npmjs.org/clockmoji', process)

Expand Down

0 comments on commit 27bcb91

Please sign in to comment.