Run the runtime tests that never ran and drop dead test code - #8710
Conversation
Path.join2, Process.cwd/argv/exit/env, Fs.existsSync/mkdirSync/ writeFileSync/readFileSync, ChildProcess.execSync and the top-level import.meta.dirname external are used by neither DocTest.res nor SpawnAsync.res (DocTest derives its directory from import.meta.url). Externals emit no JavaScript, so Node.res.js is unchanged. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stdlib_StringTests and Stdlib_ImportTests hold Test.run assertions, but no entry point included them, so they never executed; Stdlib_TestSuite now includes both (they pass). Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test.run only logged a failure, so node Stdlib_TestSuite.mjs exited 0 and scripts/test.js passed regardless; it now sets process.exitCode to 1, so the remaining assertions still run and the suite fails at exit. The unused process.exit external is gone. All current assertions pass; a deliberately failing one makes the suite exit 1. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/test.js runs mocha on tests/tests/src/**/*_test.mjs, so the describe blocks in arity_deopt, bs_ignore_effect, inline_map_demo, int_poly_var, recursive_module, test_case_opt_collision, test_for_of, test_string_const, test_zero_nullable and tramp_fib never ran. Each is renamed to a *_test name (recursive_module2_test, since recursive_module_test exists; the test_ prefix is dropped where the suffix is added) and its regenerated .mjs committed; the module name and __LOC__ strings change with the file name. All 22 tests pass (mocha 580 passing, from 558). Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test_utils.approxEq in tests/tests/src and tests/belt_tests/src has no caller in either suite; the tests/tests copy's doc comment also said it returns a bool, while it asserts. Their compiled test_utils.mjs lose the export. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each removed source repeats another test's program: DerivingAccessorsUncurried is DerivingAccessorsCurried plus a no-op @@uncurried (byte-identical .mjs); conditional/cond_c equals cond_b and cond_a_C equals cond_a_B up to the module name; test_u is test_fib.res:54-62; test_eq is the first line of test_ari.res; belt test_for_map is test_for_map2 up to the alias name. None is imported by another test. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gpr_441.res, gpr_1759_test.res and gpr_4494_test.res are entirely commented out, and debug_tmp.res is a @@config with commented-out code; each compiles to the empty-output stub and nothing imports them. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The removed comments state what the code no longer does: DotDotDot's commented-out spread parses and compiles; bs_auto_uncurry's arity-adjust wrapper and a_scope_bug's even$1 renaming are absent from the committed .mjs; pipe_send_readline has no [@@bs.xx]; test_literal compiles; test_dup_param shows duplicate parameters compile in strict mode (test_seq's FIXME); test_pervasive and test_string_case carried OCaml compile-command footers. int_overflow_test's hex comments were swapped. No .mjs changes. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
float_test checked generic_lessequal against nan twice per order and float_lessequal never; it now checks each once. optional_ffi_test's second pair read counter instead of counter2, the ref bug_to_fix2 updates. flexible_array_test computed the 500-element sort comparison and discarded it; it is now asserted. Labels: Stdlib_PromiseTest "value should be 5" asserts 10, string_const_test "getUnsafe" tests codePointAt, belt_list_test had a "droo" test and two named "makeBy". Belt comments: list_test called a five-int list a tuple, ticker's doc said sort_uniq where the code sorts, and bs_map_set_dict_test claimed assertions above that only log. All pass (mocha 580, stdlib suite). Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its one mocha test is named "weak array commented out tests" and says the tests are commented out, but the file holds no commented-out tests: its only assertion is eq(__LOC__, 1, 1), and nothing imports it. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No tests/tests source calls Node_assert.notDeepEqual or aliases the module. The binding is an external, so node_assert.mjs is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d6173d71d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| include Stdlib_IteratorTests | ||
| include Stdlib_RegExpTest | ||
| include Stdlib_StringTests | ||
| include Stdlib_ImportTests |
There was a problem hiding this comment.
Invoke the dynamic-import test instead of only importing it
Including this module still does not run its assertion: Stdlib_ImportTests.res ends with main->ignore, which ignores the async function value rather than calling it, and the generated Stdlib_ImportTests.mjs only exports main without invoking it. Consequently, when scripts/test.js executes Stdlib_TestSuite.mjs, the newly included dynamic-import test remains untested; call main() (and retain/await its promise as appropriate) from the suite or module.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: main->ignore discarded the async function, so the dynamic-import assertion never ran (changing the expected value to 2 still left node tests/tests/src/stdlib/Stdlib_TestSuite.mjs at exit 0). 9419b6d calls main()->ignore, and the regenerated .mjs now invokes main() at module load; Test.run sets process.exitCode = 1 on failure, so the same broken assertion now prints the failure and exits 1. The existing assertion in Stdlib_ImportTests.res is the test that now runs.
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8710 |
Stdlib_ImportTests ended with main->ignore, which discards the async function instead of calling it, so its assertion never ran. Call main() so a failing assertion sets the exit code of Stdlib_TestSuite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8710 +/- ##
==========================================
+ Coverage 78.67% 79.19% +0.51%
==========================================
Files 476 473 -3
Lines 64402 64011 -391
==========================================
+ Hits 50670 50691 +21
+ Misses 13732 13320 -412 🚀 New features to boost your workflow:
|
Part of #8712.
Summary
Test plan
dune builddune build @fmtdune build --profile browser @checkmakemake liblib/outputsmake testmake test-analysismake test-toolsmake test-gentypemake test-syntaxmake checkformatnpm run check🤖 Generated with Claude Code