HS: runtimeErrors generator patch (+18 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 6m5s

Add `await error(` pattern to generate_eval_only_test — maps
expect(await error("EXPR")).toBe("MSG") to (assert= (eval-hs-error "EXPR") "MSG").
Regenerate behavioral tests; 18 runtimeErrors stubs become real assertions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 15:28:03 +00:00
parent f4ef4033de
commit d47db58cde
2 changed files with 59 additions and 18 deletions

View File

@@ -2213,41 +2213,75 @@
;; ── core/runtimeErrors (18 tests) ──
(defsuite "hs-upstream-core/runtimeErrors"
(deftest "reports basic function invocation null errors properly"
(error "SKIP (untranslated): reports basic function invocation null errors properly"))
(hs-cleanup!)
(assert= (eval-hs-error "x()") "'x' is null")
(assert= (eval-hs-error "x.y()") "'x' is null")
(assert= (eval-hs-error "x.y.z()") "'x.y' is null"))
(deftest "reports basic function invocation null errors properly w/ of"
(error "SKIP (untranslated): reports basic function invocation null errors properly w/ of"))
(hs-cleanup!)
(assert= (eval-hs-error "z() of y of x") "'z' is null"))
(deftest "reports basic function invocation null errors properly w/ possessives"
(error "SKIP (untranslated): reports basic function invocation null errors properly w/ possessives"))
(hs-cleanup!)
(assert= (eval-hs-error "x's y()") "'x' is null")
(assert= (eval-hs-error "x's y's z()") "'x's y' is null"))
(deftest "reports null errors on add command properly"
(error "SKIP (untranslated): reports null errors on add command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "add .foo to #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "add @foo to #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "add {display:none} to #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on decrement command properly"
(error "SKIP (untranslated): reports null errors on decrement command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "decrement #doesntExist's innerHTML") "'#doesntExist' is null"))
(deftest "reports null errors on default command properly"
(error "SKIP (untranslated): reports null errors on default command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "default #doesntExist's innerHTML to 'foo'") "'#doesntExist' is null"))
(deftest "reports null errors on hide command properly"
(error "SKIP (untranslated): reports null errors on hide command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "hide #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on increment command properly"
(error "SKIP (untranslated): reports null errors on increment command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "increment #doesntExist's innerHTML") "'#doesntExist' is null"))
(deftest "reports null errors on measure command properly"
(error "SKIP (untranslated): reports null errors on measure command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "measure #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on put command properly"
(error "SKIP (untranslated): reports null errors on put command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "put 'foo' into #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' into #doesntExist's innerHTML") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' into #doesntExist.innerHTML") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' before #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' after #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' at the start of #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "put 'foo' at the end of #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on remove command properly"
(error "SKIP (untranslated): reports null errors on remove command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "remove .foo from #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "remove @foo from #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "remove #doesntExist from #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on send command properly"
(error "SKIP (untranslated): reports null errors on send command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "send 'foo' to #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on sets properly"
(error "SKIP (untranslated): reports null errors on sets properly"))
(hs-cleanup!)
(assert= (eval-hs-error "set x's y to true") "'x' is null")
(assert= (eval-hs-error "set x's @y to true") "'x' is null"))
(deftest "reports null errors on settle command properly"
(error "SKIP (untranslated): reports null errors on settle command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "settle #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on show command properly"
(error "SKIP (untranslated): reports null errors on show command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "show #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on toggle command properly"
(error "SKIP (untranslated): reports null errors on toggle command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "toggle .foo on #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "toggle between .foo and .bar on #doesntExist") "'#doesntExist' is null")
(assert= (eval-hs-error "toggle @foo on #doesntExist") "'#doesntExist' is null"))
(deftest "reports null errors on transition command properly"
(error "SKIP (untranslated): reports null errors on transition command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "transition #doesntExist's *visibility to 0") "'#doesntExist' is null"))
(deftest "reports null errors on trigger command properly"
(error "SKIP (untranslated): reports null errors on trigger command properly"))
(hs-cleanup!)
(assert= (eval-hs-error "trigger 'foo' on #doesntExist") "'#doesntExist' is null"))
)
;; ── core/scoping (20 tests) ──

View File

@@ -2318,6 +2318,13 @@ def generate_eval_only_test(test, idx):
lines = []
safe_name = sx_name(test['name'])
# runtimeErrors: expect(await error("EXPR")).toBe("MSG") → eval-hs-error
if 'await error(' in body:
error_pats = re.findall(r'expect\(await error\("([^"]+)"\)\)\.toBe\("([^"]+)"\)', body)
if error_pats:
asserts = '\n'.join(f' (assert= (eval-hs-error "{e}") "{m}")' for e, m in error_pats)
return f' (deftest "{safe_name}"\n (hs-cleanup!)\n{asserts})'
# Special case: cluster-33 cookie tests. Each test calls a sequence of
# `_hyperscript("HS")` inside `page.evaluate(()=>{...})`. The runner backs
# `cookies` with a Proxy over a per-test `__hsCookieStore` map (see