Skip to content

Commit 5bb8460

Browse files
committed
Adds travis config
1 parent baaf17f commit 5bb8460

File tree

7 files changed

+93
-5
lines changed

7 files changed

+93
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ node_modules
66
.rts2_cache_umd
77
.rts2_cache_system
88
dist
9-
test/temp.png
9+
test/temp.png
10+
coverage

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ An unofficial package allowing you to create Node Server instances of your Zeit
44

55
Doing so allows you to write unit/integration tests for your routes.
66

7+
[![npm](https://img.shields.io/npm/v/zeit-now-node-server.svg?style=flat-square)](http://npm.im/zeit-now-node-server)
8+
[![MIT License](https://img.shields.io/npm/l/zeit-now-node-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
9+
[![Travis](https://img.shields.io/travis/ctrlplusb/zeit-now-node-server.svg?style=flat-square)](https://travis-ci.org/ctrlplusb/zeit-now-node-server)
10+
[![Codecov](https://img.shields.io/codecov/c/github/ctrlplusb/zeit-now-node-server.svg?style=flat-square)](https://codecov.io/github/ctrlplusb/zeit-now-node-server)
11+
712
## Installation
813

914
```bash

myBinaryFile

-48.2 KB
Binary file not shown.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"start": "tsdx watch",
1919
"build": "tsdx build",
2020
"test": "tsdx test",
21-
"lint": "tsdx lint"
21+
"lint": "tsdx lint",
22+
"test:coverage": "npm run test -- --coverage",
23+
"test:coverage:deploy": "npm run test:coverage && codecov"
2224
},
2325
"peerDependencies": {},
2426
"husky": {
@@ -40,6 +42,7 @@
4042
"@types/micro": "^7.3.3",
4143
"@types/test-listen": "^1.1.0",
4244
"axios": "^0.19.0",
45+
"codecov": "^3.6.1",
4346
"form-data": "^2.5.1",
4447
"husky": "^3.0.9",
4548
"jest": "^24.9.0",

test/zeit-now-node-server.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import axios from 'axios';
44
import fs from 'fs';
55
import path from 'path';
66
import listen from 'test-listen';
7-
import nowNodeServer from '../src';
7+
import createServer from '../src';
88

99
let server: Server;
1010
let url: string;
1111
let route: (req: NowRequest, res: NowResponse) => any;
1212

1313
beforeAll(async () => {
14-
server = nowNodeServer((req, res) => {
14+
server = createServer((req, res) => {
1515
if (route) {
1616
return route(req, res);
1717
}
@@ -164,6 +164,7 @@ describe('request handling', () => {
164164

165165
const formUrlEncoded = (x: object) =>
166166
Object.keys(x).reduce(
167+
// @ts-ignore
167168
(p, c) => p + `&${c}=${encodeURIComponent(x[c])}`,
168169
''
169170
);

travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
language: node_js
3+
cache:
4+
yarn: true
5+
directories:
6+
- node_modules
7+
node_js:
8+
- "node"
9+
script:
10+
# Unfortunately flow falls over when a dep exists in peer deps and others. :(
11+
# @see https://github.com/flowtype/flow-typed/issues/528
12+
#- yarn run flow:defs
13+
- yarn run test
14+
after_success:
15+
# Deploy code coverage report to codecov.io
16+
- yarn run test:coverage:deploy

yarn.lock

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,13 @@ acorn@^7.1.0:
11161116
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
11171117
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
11181118

1119+
agent-base@^4.3.0:
1120+
version "4.3.0"
1121+
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
1122+
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
1123+
dependencies:
1124+
es6-promisify "^5.0.0"
1125+
11191126
ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5:
11201127
version "6.10.2"
11211128
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52"
@@ -1203,6 +1210,11 @@ argparse@^1.0.7:
12031210
dependencies:
12041211
sprintf-js "~1.0.2"
12051212

1213+
argv@^0.0.2:
1214+
version "0.0.2"
1215+
resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab"
1216+
integrity sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=
1217+
12061218
aria-query@^3.0.0:
12071219
version "3.0.0"
12081220
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
@@ -1727,6 +1739,17 @@ code-point-at@^1.0.0:
17271739
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
17281740
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
17291741

1742+
codecov@^3.6.1:
1743+
version "3.6.1"
1744+
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.6.1.tgz#f39fc49413445555f81f8e3ca5730992843b4517"
1745+
integrity sha512-IUJB6WG47nWK7o50etF8jBadxdMw7DmoQg05yIljstXFBGB6clOZsIj6iD4P82T2YaIU3qq+FFu8K9pxgkCJDQ==
1746+
dependencies:
1747+
argv "^0.0.2"
1748+
ignore-walk "^3.0.1"
1749+
js-yaml "^3.13.1"
1750+
teeny-request "^3.11.3"
1751+
urlgrey "^0.4.4"
1752+
17301753
collection-visit@^1.0.0:
17311754
version "1.0.0"
17321755
resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"
@@ -1913,7 +1936,7 @@ debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
19131936
dependencies:
19141937
ms "2.0.0"
19151938

1916-
debug@^3.2.6:
1939+
debug@^3.1.0, debug@^3.2.6:
19171940
version "3.2.6"
19181941
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
19191942
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
@@ -2111,6 +2134,18 @@ es-to-primitive@^1.2.0:
21112134
is-date-object "^1.0.1"
21122135
is-symbol "^1.0.2"
21132136

2137+
es6-promise@^4.0.3:
2138+
version "4.2.8"
2139+
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
2140+
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
2141+
2142+
es6-promisify@^5.0.0:
2143+
version "5.0.0"
2144+
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
2145+
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
2146+
dependencies:
2147+
es6-promise "^4.0.3"
2148+
21142149
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
21152150
version "1.0.5"
21162151
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -2847,6 +2882,14 @@ http-signature@~1.2.0:
28472882
jsprim "^1.2.2"
28482883
sshpk "^1.7.0"
28492884

2885+
https-proxy-agent@^2.2.1:
2886+
version "2.2.4"
2887+
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
2888+
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
2889+
dependencies:
2890+
agent-base "^4.3.0"
2891+
debug "^3.1.0"
2892+
28502893
humanize-duration@^3.15.3:
28512894
version "3.21.0"
28522895
resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.21.0.tgz#ae5dc7e67640770cbf6a8d03a5d1138d47c7ce38"
@@ -4120,6 +4163,11 @@ no-case@^2.2.0:
41204163
dependencies:
41214164
lower-case "^1.1.1"
41224165

4166+
node-fetch@^2.2.0:
4167+
version "2.6.0"
4168+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
4169+
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
4170+
41234171
node-int64@^0.4.0:
41244172
version "0.4.0"
41254173
resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b"
@@ -5626,6 +5674,15 @@ tar@^4:
56265674
safe-buffer "^5.1.2"
56275675
yallist "^3.0.3"
56285676

5677+
teeny-request@^3.11.3:
5678+
version "3.11.3"
5679+
resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-3.11.3.tgz#335c629f7645e5d6599362df2f3230c4cbc23a55"
5680+
integrity sha512-CKncqSF7sH6p4rzCgkb/z/Pcos5efl0DmolzvlqRQUNcpRIruOhY9+T1FsIlyEbfWd7MsFpodROOwHYh2BaXzw==
5681+
dependencies:
5682+
https-proxy-agent "^2.2.1"
5683+
node-fetch "^2.2.0"
5684+
uuid "^3.3.2"
5685+
56295686
terser@^4.1.0:
56305687
version "4.3.9"
56315688
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.9.tgz#e4be37f80553d02645668727777687dad26bbca8"
@@ -5956,6 +6013,11 @@ urix@^0.1.0:
59566013
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
59576014
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
59586015

6016+
urlgrey@^0.4.4:
6017+
version "0.4.4"
6018+
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
6019+
integrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=
6020+
59596021
use@^3.1.0:
59606022
version "3.1.1"
59616023
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"

0 commit comments

Comments
 (0)