test(oxfmt): Add oxfmt --lsp test#16866
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
The new --lsp test is likely flaky because it closes stdin immediately and only asserts on substring matches rather than decoding a complete LSP frame and validating the JSON-RPC response. Additionally, runCli() now enforces a timeout: 1000, which is prone to CI intermittency and may cause random failures for slower startup paths. Tightening the test to read/parse a full response and making the timeout configurable would significantly improve reliability.
Summary of changes
What changed
- Added a new Vitest test
apps/oxfmt/test/lsp.test.tsthat startsoxfmtwith--lsp, sends a JSON-RPCinitializerequest over stdin, and asserts the process exits successfully and returns an LSP-ish response (e.g.,Content-Length:and"capabilities"). - Refactored
apps/oxfmt/test/utils.ts:- Introduced a shared
runCli(cwd, args)helper that returns the rawexeca()result (withreject: falseand atimeout: 1000). - Removed the custom
RunResultwrapper type and mapping. - Updated
formatSnapshot()to acceptexeca’sResulttype and normalizeexitCode/stdout/stderr(exitCode ?? -1,String(stdout),String(stderr)).
- Introduced a shared
3444300 to
1289271
Compare
203ffa2 to
a9148bd
Compare
1289271 to
e8e305f
Compare
Merge activity
|
Just adding test, but it requires to update test utils.
a9148bd to
3dcb523
Compare
e8e305f to
1d9e0f4
Compare

Just adding test, but it requires to update test utils.