-
Notifications
You must be signed in to change notification settings - Fork 352
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
test(command-dev): log dev server output on timeout #1694
Conversation
tests/utils/dev-server.js
Outdated
@@ -63,6 +66,9 @@ const startServer = async ({ cwd, env = {}, args = [] }) => { | |||
}) | |||
ps.catch((error) => !selfKilled && reject(error)) | |||
}) | |||
|
|||
const { timeout, ...server } = await Promise.race([serverPromise, getTimeoutPromise(SERVER_START_TIMEOUT)]) |
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.
[sand] Do you think p-timeout
might help with this pattern?
https://github.com/sindresorhus/p-timeout
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.
Done in 12b4af1
tests/utils/dev-server.js
Outdated
ps.stdout.on('data', (data) => { | ||
if (data.toString().includes('Server now ready on')) { | ||
ps.stdout.on('data', (dataBuffer) => { | ||
const data = dataBuffer.toString() |
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 believe using the encoding: 'utf-8'
option of execa
should provide with data
string chunks instead directly. Would this work?
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.
Sure, done in a0d8158
This PR reports the dev server output in our tests when we fail to spawn it.