Closed binsee closed 2 years ago
All log levels of Brolog are supported.
log.error()
log.warn()
log.info()
log.verbose()
log.silly()
To turn off all logs, use log.level('silent')
or log.level(0)
It seems that something is not correct because the CI was failed.
Could you please try to run the npm test
locally and make sure everything is working as expected in your PR?
I'll take a look at it later.
When I submitted the pr, I tested the modified code separately, and the unit test passed.
package.json
- scripts
:
"test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm --experimental-vm-modules\" tap \"src/**/libs/*.spec.ts\"",
output:
> sidecar@1.0.22 test:unit
> cross-env NODE_OPTIONS="--no-warnings --loader=ts-node/esm --experimental-vm-modules" tap "src/**/libs/*.spec.ts"
TAP version 13
ok 1 - src/agent/templates/libs/log.spec.ts # time=11.917ms {
# Subtest: log()
ok 1 - should call spy only one
ok 2 - should get correct payload event
1..2
ok 1 - log() # time=7.384ms
1..1
# time=11.917ms
}
ok 2 - src/agent/templates/libs/payload.spec.ts # time=14.101ms {
# Subtest: __sidecar__payloadLog()
ok 1 - should get log payload correctly
1..1
ok 1 - __sidecar__payloadLog() # time=7.431ms
# Subtest: __sidecar__payloadHook()
ok 1 - should make hook payload correctly.
1..1
ok 2 - __sidecar__payloadHook() # time=1.672ms
1..2
# time=14.101ms
}
1..2
# time=583.021ms
-------------|---------|----------|---------|---------|------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------|---------|----------|---------|---------|------------------------------
All files | 62.22 | 39.28 | 72.72 | 62.22 |
log.cjs | 56.41 | 33.33 | 66.66 | 56.41 | 16-37,57,67,71-72,98,104-111
payload.cjs | 100 | 75 | 100 | 100 | 46
-------------|---------|----------|---------|---------|------------------------------
I run npm test on the pr branch and the main branch. The detection results are the same, and errors will be reported, and the number of errors reported is the same.
agent-log
branch> sidecar@1.0.22 test
> npm-run-all lint test:unit
// ....
# failed 6 of 47 tests
# time=9429.162ms
--------------------------|---------|----------|---------|---------|------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------|---------|----------|---------|---------|------------------------------
All files | 64.58 | 39.28 | 72.72 | 64.58 |
commonjs | 100 | 100 | 100 | 100 |
code-root.cjs | 100 | 100 | 100 | 100 |
src/agent/templates/libs | 62.22 | 39.28 | 72.72 | 62.22 |
log.cjs | 56.41 | 33.33 | 66.66 | 56.41 | 16-37,57,67,71-72,98,104-111
payload.cjs | 100 | 75 | 100 | 100 | 46
--------------------------|---------|----------|---------|---------|------------------------------
ERROR: "test:unit" exited with 1.
main
branch> sidecar@1.0.19 test
> npm-run-all lint test:unit
// ...
# failed 6 of 47 tests
# time=10417.556ms
--------------------------|---------|----------|---------|---------|----------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------|---------|----------|---------|---------|----------------------
All files | 72.5 | 42.85 | 87.5 | 72.5 |
commonjs | 100 | 100 | 100 | 100 |
code-root.cjs | 100 | 100 | 100 | 100 |
src/agent/templates/libs | 70.27 | 42.85 | 87.5 | 70.27 |
log.cjs | 64.51 | 35.29 | 83.33 | 64.51 | 23-24,35-39,62,68-72
payload.cjs | 100 | 75 | 100 | 100 | 46
--------------------------|---------|----------|---------|---------|----------------------
ERROR: "test:unit" exited with 1.
Thanks for the details information, it seems the problem is not related to this PR.
Let's merge this PR first and then figure the problem out in the main branch.
Link #27, #28