Skip to content

Commit

Permalink
ci(travis): add Node.js 12+13 to Travis CI test matrix (#742)
Browse files Browse the repository at this point in the history
* ci(travis): add Node.js 12+13 to Travis CI test matrix

* ci: fix tests under Node.js 13
  • Loading branch information
watson authored and mcollina committed Nov 20, 2019
1 parent 29a2419 commit b03028a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_js:
- 8
- 10
- 11
- 12
- 13
script:
- npm run ci
env:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"proxyquire": "^2.1.3",
"pump": "^3.0.0",
"qodaa": "^1.0.1",
"semver": "^6.3.0",
"snazzy": "^8.0.0",
"split2": "^3.1.1",
"standard": "^14.2.0",
Expand Down
12 changes: 9 additions & 3 deletions test/http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const http = require('http')
const os = require('os')
const semver = require('semver')
const { test } = require('tap')
const { sink, once } = require('./helper')
const pino = require('../')
Expand Down Expand Up @@ -84,7 +85,7 @@ test('http request support via serializer', async ({ ok, same, error, teardown }
server.close()
})

test('http request support via serializer without request connection', async ({ ok, isLike, error, teardown }) => {
test('http request support via serializer without request connection', async ({ ok, same, error, teardown }) => {
var originalReq
const instance = pino({
serializers: {
Expand All @@ -93,7 +94,7 @@ test('http request support via serializer without request connection', async ({
}, sink((chunk, enc) => {
ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()')
delete chunk.time
isLike(chunk, {
const expected = {
pid: pid,
hostname: hostname,
level: 30,
Expand All @@ -104,7 +105,12 @@ test('http request support via serializer without request connection', async ({
url: originalReq.url,
headers: originalReq.headers
}
})
}
if (semver.gte(process.version, '13.0.0')) {
expected.req.remoteAddress = originalReq.connection.remoteAddress
expected.req.remotePort = originalReq.connection.remotePort
}
same(chunk, expected)
}))

const server = http.createServer(function (req, res) {
Expand Down

0 comments on commit b03028a

Please sign in to comment.