-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Replace exec with spawn in performance runner script #62270
Conversation
Size Change: +20 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
bin/plugin/lib/utils.js
Outdated
HOME: process.env.HOME, | ||
USER: process.env.USER, | ||
...env, | ||
}, |
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.
Another thing to try is using spawn
instead of exec
. The difference is that you can pass the stdio: 'inherit' option to
spawn`.
exec
is running the command inside a shell, but we don't need that for npm run
. There are other usages of runShellScript
that run cp -R
, and cp
is a shell built-in -- for these whe have the shell: true
option for spawn
.
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.
Agreed! I was also considering it some time ago when we had similar logging issues, as it allows for better debugging since it streams the output, which is often quite large. Never got to trying it out, though. Anyhow, if this quick-fix doesn't help, we can try refactoring to spawn
.
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.
It still prints the same error with spawn. stdio
is set to inherit
and it still doesn't print the tests output. What am I doing wrong? 😅
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 more idea to try: run directly the test-playwright.js
script. This works locally:
node ./packages/scripts/scripts/test-playwright.js --config test/performance/playwright.config.ts site-editor
Currently there are so many levels of indirection. The GitHub action spawns a node bin/plugin/cli.js
process, which spawns a npm run
process, which spawns a wp-scripts
process, which spawns a test-playwright
process, which finally spawns the playwright
CLI process. I counted five processes 🙂 Somewhere along the way the errors get lost.
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.
It's still the same, unfortunately. 😩 I'll keep digging, but if you have any other ideas, please share! 😄
9562fca
to
8250b93
Compare
I'm getting some progress after I enabled the Here are the errors that make the job fail in this branch. I didn't even need the artificial "oopsie" error:
There's a strange 500 Internal Server Error on the |
6c8993c
to
90019c4
Compare
runShellScript
utilb6ee3d2
to
2c7e3f3
Compare
Related slack convo: link
What?
Performance tests runner seems to be swallowing the tests errors, printing a cryptic exception:
Error: Command failed: npm run test:performance -- site-editor at genericNodeError (node:internal/errors:984:15) at wrappedFn (node:internal/errors:538:14) at ChildProcess.exithandler (node:child_process:422:12) at ChildProcess.emit (node:events:519:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5) { code: 1, killed: false, signal: null, cmd: 'npm run test:performance -- site-editor' }
Let's see if passing the outputs the recommended way makes the errors appear as expected.