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
refactor: use cp.fork to preserve stdout for packages/extension build #22926
Conversation
Thanks for taking the time to open a PR!
|
I ran into this exact same thing when updating to Vite 3, and could not figure out the error w/o stdout. Good fix. |
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.
One comment, not a blocker, just offering an alternative.
@@ -15,7 +16,11 @@ const manifest = () => { | |||
} | |||
|
|||
const background = (cb) => { | |||
exec('node ../../scripts/run-webpack.js').then(() => cb()).catch(cb) |
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 thought exec
had a second arg where you could pass
exec('node ....', { stdout: ... }
But now I realize that is execa
. Another option would be to grab the stdout from the callback:
exec('node ...', (error, stdout, stderr) => {
// stuff
})
It might be more idiomatic to do something like this, and do a if (err)
check?
Either way is fine with me, I'll leave the final decision to you.
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 like the current implementation as it preserves the ansii highlighting, whereas console logging the stdout
does not.
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
60329d7
to
ca3811b
Compare
User facing changelog
na
Additional details
The extension package executes webpack inside of a gulp script. It was using a promisified
exec
script to invoke therun-webpack.js
script and it wasn't piping any of the stdout. This PR usesfork
to invoke webpack, making it easy to capture stdout withstdio: 'inherit'
.I ran into this when working through adding Angular CT support. Webpack 5 got hoisted and broke the webpack build but the error message was unclear. Now, if this script errors it will print the webpack logs.
Steps to test
Run
yarn workspace @packages/extension build
and you'll see the webpack logs. You can tweak the src files to throw a compilation error to verify that a non-zero exit code causes the gulp task to fail.How has the user experience changed?
Before:
After:
PR Tasks
cypress-documentation
?type definitions
?