Conversation
|
| harness.expectTrue("Math.abs(c.textSize - 18) < 0.01") | ||
| #expect(!harness.hasException) |
There was a problem hiding this comment.
Assignment exceptions go undetected
expectTrue starts a new JavaScript evaluation, which clears the exception recorded by the assignment block before hasException checks it. If an invalid assignment throws but leaves the size unchanged, this test still passes, so it does not verify that invalid values are ignored without an exception. Check hasException immediately after the assignment block. The subtext and query tests have the same pattern.
Prompt To Fix With AI
This is a comment left during a code review.
Path: Hammerspoon 2Tests/IntegrationTests/HSChooserIntegrationTests.swift
Line: 487-488
Comment:
**Assignment exceptions go undetected**
`expectTrue` starts a new JavaScript evaluation, which clears the exception recorded by the assignment block before `hasException` checks it. If an invalid assignment throws but leaves the size unchanged, this test still passes, so it does not verify that invalid values are ignored without an exception. Check `hasException` immediately after the assignment block. The subtext and query tests have the same pattern.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Closes #226