-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: define bin.js #24
Conversation
@@ -9,8 +9,14 @@ | |||
"example": "examples", | |||
"test": "test" | |||
}, | |||
"bin": { | |||
"one-line-logger": "./bin.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should i use one-line-logger name here or something else? @fastify/one-time-logger is not a valid bin name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think simplicity and fast to type thing is better:
1l
1line
@@ -24,11 +24,10 @@ tap.beforeEach(() => { | |||
}) | |||
|
|||
test('should log server started messages', async (t) => { | |||
await server.listen({ port: 63995 }) | |||
await server.listen({ port: 63995, host: '127.0.0.1' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this, because the previous code was not os-independent.
e.g. ipv6 may not be available.
@@ -52,6 +53,8 @@ const mockTime = () => { | |||
|
|||
// eslint-disable-next-line | |||
Date.prototype.getHours = () => HOUR; | |||
// eslint-disable-next-line | |||
Date.prototype.getMinutes = () => MIN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMinutes
also should be mocked. otherwise tests will won't pass on some timezones. (e.g: +00:30 ,+01:30. +02:30 ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add please corresponding unmock code to unmockTime
@Uzlopak feel free to close it |
fixes #23
Checklist
npm run test
andnpm run benchmark
and the Code of conduct