Skip to content

Commit

Permalink
feature(serve-once) add madrun
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Sep 5, 2019
1 parent b16840a commit 5646436
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 46 deletions.
19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

10 changes: 10 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,10 @@
{
"extends": [
"plugin:putout/recommended",
"plugin:node/recommended"
],
"plugins": [
"putout",
"node"
]
}
8 changes: 0 additions & 8 deletions .eslintrc.test

This file was deleted.

2 changes: 2 additions & 0 deletions .npmignore
Expand Up @@ -3,3 +3,5 @@ test
*.swp
coverage

madrun.js

2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 11
- 12
- 10
- 8

Expand Down
2 changes: 1 addition & 1 deletion lib/serve-once.js
Expand Up @@ -81,7 +81,7 @@ module.exports = (middle, options) => {
return {
request: req,
serve: bind(serve, middle),
}
};
};

function check(middle) {
Expand Down
14 changes: 14 additions & 0 deletions madrun.js
@@ -0,0 +1,14 @@
'use strict';

const {run} = require('madrun');

module.exports = {
'test': () => 'tape test/*.js',
'lint': () => 'putout lib test madrun.js',
'fix:lint': () => run('lint', '--fix'),
'watch:test': () => run('watcher', '"npm test"'),
'watcher': () => 'nodemon -w lib -w test -x',
'coverage': () => 'nyc npm test',
'report': () => 'nyc report --reporter=text-lcov | coveralls',
};

25 changes: 12 additions & 13 deletions package.json
Expand Up @@ -21,14 +21,13 @@
"url": "git://github.com/coderaiser/node-serve-once.git"
},
"scripts": {
"test": "tape test/*.js",
"lint": "redrun lint:*",
"lint:lib": "eslint lib",
"lint:test": "eslint test -c .eslintrc.test",
"watch:test": "npm run watcher -- \"npm test\"",
"watcher": "nodemon -w lib -w test -x",
"coverage": "nyc npm test",
"report": "nyc report --reporter=text-lcov | coveralls"
"test": "madrun test",
"lint": "madrun lint",
"fix:lint": "madrun fix:lint",
"watch:test": "madrun watch:test",
"watcher": "madrun watcher",
"coverage": "madrun coverage",
"report": "madrun report"
},
"dependencies": {
"express": "^5.0.0-alpha.7",
Expand All @@ -44,13 +43,13 @@
"coveralls": "^3.0.0",
"eslint": "^6.3.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-putout": "^2.0.0",
"madrun": "^3.0.1",
"nodemon": "^1.11.0",
"nyc": "^14.1.1",
"pullout": "^3.0.0",
"redrun": "^7.0.0",
"rimraf": "^2.6.2",
"tape": "^4.2.0",
"try-catch": "^2.0.0",
"try-to-tape": "^1.0.0"
"putout": "^5.11.1",
"supertape": "^1.2.3",
"try-catch": "^2.0.0"
}
}
7 changes: 3 additions & 4 deletions test/serve-once.js
Expand Up @@ -2,15 +2,14 @@

const fs = require('fs');

const tryToTape = require('try-to-tape');
const test = tryToTape(require('tape'));
const test = require('supertape');
const tryCatch = require('try-catch');
const pullout = require('pullout');

const serveOnce = require('..');

test('serve-once: no middleware', (t) => {
const [e] = tryCatch(serveOnce)
const [e] = tryCatch(serveOnce);

t.equal(e.message, 'middleware should be a function!', 'should equal');
t.end();
Expand Down Expand Up @@ -161,7 +160,7 @@ test('serve-once: fetch: headers', async (t) => {
const {request} = serveOnce(middleware);
const {body} = await request.get('/', {
headers: {
authorization: 'basic'
authorization: 'basic',
},
type: 'json',
});
Expand Down

0 comments on commit 5646436

Please sign in to comment.