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
Using webpack with pino for serverside builds: #2 #201
Conversation
…(pretty.js), to be able to use webpack with Node.js code in AWS Lambda environments
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.
just one change :)
bin.js
Outdated
|
||
module.exports = pretty | ||
|
||
if (require.main === module) { |
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.
we no longer need this check - safe to remove since we won't be requiring bin.js
It looks like we are missing cli tests. Would you be willing add some? |
when you say CLI - do you mean pretty.js tests? |
The tests in |
@jsumners is it fine to change |
ah right right - so what are you thinking for CLI test (also as a result of this, we should add CLI test to pino-sapling) - say using child_process to exec('pino') ? |
What we are missing is:
Maybe I'm being pedantic. Or maybe they can be solved in another PR. |
another way would be to dynamically set |
@jsumners I think this is a larger discussion, one for pino-sapling in fact @joeyvandijk if you want to get involved in writing CLI tests here, that'd be great (we'd use the pattern you set for pino-sapling) - if not I'm happy to accept without CLI tests |
@davidmarkclements not having enough background with All your requested changes are done, please let me know if I missed one. |
that's great so there's two ways to do it, - you either mock process.argv, process.stin and process.stdout and do something like this var test = require('tap').test
var execSync = require('child_process').execSync
var fs = require('fs')
test('-h flag outputs usage.txt', (t) => {
var usage = fs.readFileSync('../usage.txt').toString()
var proc = execSync('node ../bin.js -h')
t.is(proc.stdout.toString(), usage)
t.end()
}) Not that tried that, might be buggy, but that's the general idea. For test purposes it's fine to use sync methods |
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.
LGTM as there were no tests before on the CLI, my bad.
I think the permissions on pretty.js must be changed, as it's still executable.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
separate CLI features for
pretty.js
(bin.js
) with default features (pretty.js
), to be able to usewebpack
with (ES6) Node.js code in serverless environments like AWS Lambda.