You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The enclosed function check uses the same assert function it receives as parameter to do some internal checks on time, pid and hostname. It is unnecessary to use default assert function (deepStrictEqual) to check on these values and this behaviour also makes it hard to create assessments on properties -- ie: when chunkCopy must contain some property foo, we also have to account for the time, pid and hostname.
My suggestion is to to use standard strictEqual on the internal checks and only use the assert function parameter on the payload (chunkCopy), itself. This is a suggestion of implementation:
functioncheck(chunk,expected,assert){const{ time, pid, hostname, ...chunkCopy}=chunk// internal assertions (*)nodeAssert.strictEqual(newDate(time)<=newDate(),true,'time is greater than Date.now()')nodeAssert.strictEqual(pid,process.pid)nodeAssert.strictEqual(hostname,os.hostname())// "consumer" assertionassert(chunkCopy,expected)}
PS: on a side note, I'm not sure whether it's actually useful to run these internal assertions each time a consumer asserts on their logs, but maybe I'm missing something here
The text was updated successfully, but these errors were encountered:
The enclosed function
check
uses the sameassert
function it receives as parameter to do some internal checks ontime
,pid
andhostname
. It is unnecessary to use default assert function (deepStrictEqual
) to check on these values and this behaviour also makes it hard to create assessments on properties -- ie: whenchunkCopy
must contain some propertyfoo
, we also have to account for thetime
,pid
andhostname
.pino-test/pino-test.js
Line 38 in c22d2ab
My suggestion is to to use standard
strictEqual
on the internal checks and only use theassert
function parameter on the payload (chunkCopy
), itself. This is a suggestion of implementation:PS: on a side note, I'm not sure whether it's actually useful to run these internal assertions each time a consumer asserts on their logs, but maybe I'm missing something here
The text was updated successfully, but these errors were encountered: