Skip to content

Commit

Permalink
test(http): use alternative names to req and res
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardolima committed Nov 9, 2024
1 parent 651d194 commit a3b1681
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ module.exports = {
formatOptsSym,
messageKeySym,
errorKeySym,
responseKeySym,
requestKeySym,
nestedKeySym,
wildcardFirstSym,
needsMetadataGsym,
Expand All @@ -72,7 +74,5 @@ module.exports = {
hooksSym,
nestedKeyStrSym,
mixinMergeStrategySym,
msgPrefixSym,
responseKeySym,
requestKeySym,
msgPrefixSym
}
12 changes: 6 additions & 6 deletions test/http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ test('http request support', async ({ ok, same, error, teardown }) => {
test('http request support via serializer', async ({ error, match }) => {

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 ubuntu-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 ubuntu-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 macOS-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 ubuntu-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 macOS-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 macOS-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 windows-latest

Expected error to be handled

Check failure on line 47 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 windows-latest

Expected error to be handled
let originalReq
const instance = pino({
requestKey: 'myRequest',
serializers: {
req: (req) => req.arbitraryProperty,

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 ubuntu-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 ubuntu-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 macOS-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 ubuntu-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 macOS-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 macOS-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 windows-latest

Unexpected trailing comma

Check failure on line 52 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 windows-latest

Unexpected trailing comma
}
Expand All @@ -56,7 +57,7 @@ test('http request support via serializer', async ({ error, match }) => {
hostname,
level: 30,
msg: 'my request',
req: originalReq.arbitraryProperty,
myRequest: originalReq.arbitraryProperty,

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 ubuntu-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 ubuntu-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 macOS-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 ubuntu-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 macOS-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 macOS-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 windows-latest

Unexpected trailing comma

Check failure on line 60 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 windows-latest

Unexpected trailing comma
})
}))

Expand All @@ -70,7 +71,6 @@ test('http request support via serializer', async ({ error, match }) => {
server.unref()
server.listen()
const err = await once(server, 'listening')

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 ubuntu-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 ubuntu-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 macOS-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 ubuntu-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 macOS-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 macOS-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 windows-latest

'err' is assigned a value but never used

Check failure on line 73 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 windows-latest

'err' is assigned a value but never used
error(err)

const res = await once(http.get('http://localhost:' + server.address().port), 'response')
res.resume()
Expand Down Expand Up @@ -157,16 +157,17 @@ test('http response support', async ({ ok, same, error, teardown }) => {
test('http response support via a serializer', async ({ match, error }) => {
let originalRes
const instance = pino({
responseKey: 'myResponse',
serializers: {
res: (res) => res.arbitraryProperty,

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 ubuntu-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 ubuntu-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 macOS-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 22 ubuntu-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 macOS-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 macOS-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 18 windows-latest

Unexpected trailing comma

Check failure on line 162 in test/http.test.js

View workflow job for this annotation

GitHub Actions / 20 windows-latest

Unexpected trailing comma
}
}, sink((chunk, enc) => {
}, sink((chunk, _enc) => {
match(chunk, {
pid,
hostname,
level: 30,
msg: 'my response',
res: originalRes.arbitraryProperty,
myResponse: originalRes.arbitraryProperty,
})
}))

Expand Down Expand Up @@ -196,7 +197,7 @@ test('http request support via serializer in a child', async ({ ok, same, error,
serializers: {
req: pino.stdSerializers.req
}
}, sink((chunk, enc) => {
}, sink((chunk, _enc) => {
ok(new Date(chunk.time) <= new Date(), 'time is greater than Date.now()')
delete chunk.time
same(chunk, {
Expand Down Expand Up @@ -224,7 +225,6 @@ test('http request support via serializer in a child', async ({ ok, same, error,
server.unref()
server.listen()
const err = await once(server, 'listening')
error(err)

const res = await once(http.get('http://localhost:' + server.address().port), 'response')
res.resume()
Expand Down

0 comments on commit a3b1681

Please sign in to comment.