test: add JavaScript optional-chaining parser fixture - #39
Conversation
There was a problem hiding this comment.
Thanks for the contribution!
The fixture is focused, the public reference
checks out, and all seven submitted parser tests pass locally.
One required correction before merging here
The new block in packages/quality-judge/tests/parser.test.ts fails the pinned Prettier check.
Please format that file with the repository's formatter and push the update.
The JavaScript fixture itself is already formatted correctly.
Optional improvement: the full-source exclusion assertion compares serialized
JSON with unescaped multiline source. Compare against the JSON-escaped source
instead, and consider checking the two distinctive optional-chain expressions.
Your existing function-name checks already catch a whole-fixture leak, so this
is test strengthening, not a production privacy defect. It does not need to
expand into analyzer changes.
We also reproduced both symlink EPERM failures on unchanged main under the same
Windows sandbox. Those are not introduced by this PR; please leave the unrelated
CLI tests untouched. The timestamp mismatch did not reproduce in our run.
After the formatting update, we'll review the final commit and decide separately
whether to approve the required hosted checks. No workflow changes are needed.
|
Formatted |
|
Thanks for the update! The PR still points to |
Summary
Observed behavior
The fixture is based on the documented behavior of optional chaining in the public
microsoft/TypeScript-Websiterepository.Reference:
microsoft/TypeScript-Websitepackages/documentation/copy/en/release-notes/TypeScript 3.7.mdImmutable commit:
7a686ece189c7f9587a245fa2270ed9dc0f03abbThe referenced release notes document optional property access (
?.) and optional element access (?.[0]). The fixture here is independently written synthetic code and does not copy source from the referenced repository.Validation
Passed:
node scripts/bootstrap.mjspnpm --filter @gitmog/quality-judge test parser.test.ts— 7/7 tests passedpnpm quality:fixturespnpm verifyreaches the full test suite but reports 3 unrelated Windows/environment-sensitive CLI test failures:cache-control.test.ts— symlink creation returnsEPERMexport-artifact.test.ts— symlink creation returnsEPERMterminal-output.test.ts— locale/time-zone formatted timestamp differs on this Windows environmentNo changes were made to those unrelated tests.
Scope / contract impact
This change only expands engineering validation coverage for a JavaScript parser edge case.
Engineering validation impact
The new fixture exercises real TypeScript compiler AST parsing for JavaScript optional chaining while keeping the fixture synthetic, bounded, and source-free in derived output.
The change is intentionally limited to the fixture and its directly associated parser tests.