Skip to content

Commit 5060ac1

Browse files
authored
Merge pull request node-fetch#289 from bitinn/2.x-fix-tests-for-node-8
2.x branch: fix testcases for node 8 and npm 5
2 parents 0674a0b + fdc2344 commit 5060ac1

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ node_modules
3333

3434
# Babel-compiled files
3535
lib
36+
37+
# Ignore package manager lock files
38+
package-lock.json
39+
yarn.lock

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ This is a major release. Check [our upgrade guide](https://github.com/bitinn/nod
1313

1414
- Major: Node.js 0.10.x and 0.12.x support is dropped
1515
- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports
16-
- Enhance: start testing on Node.js 4, 6, 7
16+
- Enhance: start testing on Node.js 4, 6, 8 LTS
1717
- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup)
1818
- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings
1919
- Other: rewrite in ES2015 using Babel
2020
- Other: use Codecov for code coverage tracking
21+
- Other: update package.json script for npm 5
2122

2223
### HTTP requests
2324

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"scripts": {
1616
"build": "cross-env BABEL_ENV=rollup rollup -c",
17-
"prepublish": "npm run build",
17+
"prepare": "npm run build",
1818
"test": "cross-env BABEL_ENV=test mocha --compilers js:babel-register test/test.js",
1919
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
2020
"coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json"

test/server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export default class TestServer {
1010
this.server = http.createServer(this.router);
1111
this.port = 30001;
1212
this.hostname = 'localhost';
13+
// node 8 default keepalive timeout is 5000ms
14+
// make it shorter here as we want to close server quickly at the end of tests
15+
this.server.keepAliveTimeout = 1000;
1316
this.server.on('error', function(err) {
1417
console.log(err.stack);
1518
});

0 commit comments

Comments
 (0)