Merge pull request #289 from bitinn/2.x-fix-tests-for-node-8
2.x branch: fix testcases for node 8 and npm 5
This commit is contained in:
commit
5060ac10f1
|
@ -33,3 +33,7 @@ node_modules
|
||||||
|
|
||||||
# Babel-compiled files
|
# Babel-compiled files
|
||||||
lib
|
lib
|
||||||
|
|
||||||
|
# Ignore package manager lock files
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|
|
@ -13,11 +13,12 @@ This is a major release. Check [our upgrade guide](https://github.com/bitinn/nod
|
||||||
|
|
||||||
- Major: Node.js 0.10.x and 0.12.x support is dropped
|
- Major: Node.js 0.10.x and 0.12.x support is dropped
|
||||||
- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports
|
- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports
|
||||||
- Enhance: start testing on Node.js 4, 6, 7
|
- Enhance: start testing on Node.js 4, 6, 8 LTS
|
||||||
- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup)
|
- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup)
|
||||||
- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings
|
- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings
|
||||||
- Other: rewrite in ES2015 using Babel
|
- Other: rewrite in ES2015 using Babel
|
||||||
- Other: use Codecov for code coverage tracking
|
- Other: use Codecov for code coverage tracking
|
||||||
|
- Other: update package.json script for npm 5
|
||||||
|
|
||||||
### HTTP requests
|
### HTTP requests
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "cross-env BABEL_ENV=rollup rollup -c",
|
"build": "cross-env BABEL_ENV=rollup rollup -c",
|
||||||
"prepublish": "npm run build",
|
"prepare": "npm run build",
|
||||||
"test": "cross-env BABEL_ENV=test mocha --compilers js:babel-register test/test.js",
|
"test": "cross-env BABEL_ENV=test mocha --compilers js:babel-register test/test.js",
|
||||||
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
|
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
|
||||||
"coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json"
|
"coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json"
|
||||||
|
|
|
@ -10,6 +10,9 @@ export default class TestServer {
|
||||||
this.server = http.createServer(this.router);
|
this.server = http.createServer(this.router);
|
||||||
this.port = 30001;
|
this.port = 30001;
|
||||||
this.hostname = 'localhost';
|
this.hostname = 'localhost';
|
||||||
|
// node 8 default keepalive timeout is 5000ms
|
||||||
|
// make it shorter here as we want to close server quickly at the end of tests
|
||||||
|
this.server.keepAliveTimeout = 1000;
|
||||||
this.server.on('error', function(err) {
|
this.server.on('error', function(err) {
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue