From 27bcb9147269bbf256f684a619213080aa013936 Mon Sep 17 00:00:00 2001 From: big kahuna burger Date: Sat, 1 Apr 2017 03:49:31 +0200 Subject: [PATCH] Coveralls (#17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐱👤 * improve coverage * pipe it * try again * can into master * bump --- .gitignore | 2 +- README.md | 8 ++++++++ package.json | 21 +++++++++++++++++---- test/index.js | 11 +++++++++-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 8f36f40..31773b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Jetbrains WebStorm .idea - +.nyc_output # Logs logs *.log diff --git a/README.md b/README.md index 50fbb08..6e9cd1a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ [![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 @@ -10,6 +14,10 @@ [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. diff --git a/package.json b/package.json index 735e63a..c20b929 100644 --- a/package.json +++ b/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 ", "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", @@ -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", @@ -42,5 +47,13 @@ "contributors": [ "Arandjel Sarenac " ], - "typings": "index.d.ts" + "typings": "index.d.ts", + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + } } diff --git a/test/index.js b/test/index.js index 8a07521..9e1aa36 100644 --- a/test/index.js +++ b/test/index.js @@ -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) @@ -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') @@ -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)