0175 - test262 harness includes are separate non-strict Scripts, and only the test file is made strict
Date: 2026-11-05
Area: testing
Related: ADR 0042, ADR 0050, ADR 0051, ADR 0120, #2067, #2069
The test262 runner joined the harness files and the test body into one source and put the "use strict" directive of an onlyStrict run in front of both, so the harness became strict code. Helpers such as harness/sm/non262-strict-shell.js, which run the lenient half of a check through a direct eval inside a harness function, then could never pass. test262's INTERPRETING.md says each include is evaluated in the test realm's global scope before the test and the directive is inserted into the test file. The runner now evaluates each harness file as its own global Script through EvaluateTest262Script, the path $262.evalScript already used, and then the test file, prefixed with "use strict"; and a newline in a strict run, as a Script or Module. TGocciaEngine.ExecuteScriptProgram runs each Script under its own source path with its declarations bound in the global environment, whatever the entry's goal. Every test, a module test included, gets non-strict compatibility, because module code stays strict whatever the flag says while the harness Scripts it evaluates first are Script code; this replaces the rule of ADR 0050 and ADR 0051 that the runner passes the flag to Script tests only. Because the harness declarations are now real global bindings, the module content provider no longer prepends a joined copy of the harness to a test file a test imports, which ran the harness a second time as strict module code, and goccia-global-shim.js, which re-published module-scoped harness bindings on globalThis, is gone. With the harness out of the test's source there is nothing to keep apart from the test's own errors, so negative-runtime tests drop the marker-printing try wrapper, which also turned top-level declarations into block-scoped ones, and are graded on the test's own escaped throw. A harness Script that fails means the test never ran, so it is a wrapper-infrastructure result, not a conformance one. This replaces ADR 0042's harness + body concatenation, refines ADR 0051's directive placement, and is grading contract 3. test262.md.