test(windows): read windowsHide the way an object literal evaluates - #360
Merged
Merged
Conversation
The guard only let a spread turn windowsHide on, so
`{ windowsHide: true, ...{ windowsHide: false } }` passed although the
child would get a console. Members now apply in order: a spread clears an
earlier `true` unless it provably has no windowsHide key, and a computed
key, shorthand, accessor or method that may set windowsHide clears it too.
Quoted keys count. Cycle detection follows the bindings being expanded, so
a value spread twice is no longer mistaken for a cycle.
A parameter is now checked against every call. An omitted argument takes
the parameter's default, and a spread argument that may supply it makes
it unprovable. A loop variable no longer borrows an outer binding's proof.
Variables are still read from their initializers; the doc comment says so.
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.
child-process-windows-hide.test.tschecks that everychild_processspawn undersrc/setswindowsHide: true. Its object-literal reader only let a spread turn the option on, so{ windowsHide: true, ...{ windowsHide: false } }passed although the child would open a console window. This came up in review of #359.The reader now applies members in source order, the way the literal evaluates:
trueunless it provably has nowindowsHidekey.windowsHideclears it too. Quoted keys count.Variables are still read from their initializers, so a later mutation or a getter's side effect goes unseen. The doc comment says so: the guard catches a forgotten option, not code written to evade it.
Test-only change: no CHANGELOG entry. README rows checked: none describe this guard.
Checks
src/spawn sites pass (36 proven, 2 allowlisted).