feat(local): format virtualTree boot failure as readable stderr + exit 1#759
Merged
Conversation
Member
Author
|
QA レビュー反映:
|
…ror branch - New `commands/server.spec.ts` boots `runServerCommand` via tsx in a child process so the wrapper integration is now covered: removing the `loadResolverStateOrExit` call from `runServerCommand` would now fail. - Replace `String(error)` fallback in the wrapper with an explicit `instanceof Error` check that re-throws on non-Error values, eliminating the previously untestable code path.
a835e4c to
7119d75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #754.
virtualTree.enabled = trueで起動するときにloadResolverStateが throw すると、Node のデフォルト uncaught handler がError:プレフィックスとスタックトレースを混ぜて出すため、PathConflictError.messageが持つ「どのファイルが衝突しているか」の構造化情報が読みづらかった。また、process.exit(1)の契約を保証するテストもなく、commands/server.tsからloadResolverState呼び出しを丸ごと消してもテストが green のままだった(ゴーストコード)。commands/load-resolver-state-or-exit.tsを追加し、try/catch でPathConflictErrorと一般 Error を整形して stderr に出してからprocess.exit(1)commands/server.tsを新ヘルパ経由に切り替え、JSDoc も更新commands/load-resolver-state-or-exit.spec.tsで 3 ケース検証:process.exitは呼ばれないTest plan
npx vitest run src/commands/load-resolver-state-or-exit.spec.ts— 3 passednpx vitest run src/route.spec.ts ... src/commands/load-resolver-state-or-exit.spec.ts— 既存 100 + 新規 3 すべてパスyarn build --scope @burger-editor/local— typecheck + bundle 成功Notes
elseでError以外もまとめてString(error)経由で扱うことで分岐を 2 つに減らし、テスト可能な範囲だけを残した(観点 5: ゴーストコード回避)commands/search.tsと同様、CLI 経路のconsole.errorはno-consoleの意図的な warning(既存パターンに合わせている)