Skip to content

Run the runtime tests that never ran and drop dead test code - #8710

Merged
cknitt merged 12 commits into
masterfrom
cristianoc/tests-runtime
Oct 3, 2026
Merged

cknitt merged 12 commits into
masterfrom
cristianoc/tests-runtime

Conversation

@cristianoc

@cristianoc cristianoc commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #8712.

Summary

  • Remove unused bindings from the docstring tests' Node module. 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.
  • Run the stdlib String and dynamic-import tests. 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).
  • Make a failing stdlib Test.run fail the test process. 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.
  • Name the unloaded mocha suites _test so mocha runs them. 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).
  • Remove the unused approxEq test helpers. 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.
  • Remove duplicate codegen snapshot tests. 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.
  • Remove test sources that hold only comments. 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.
  • Remove stale comments from tests/tests sources. 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.
  • Fix test assertions and labels that disagree with their code. 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).
  • Remove gpr_2789_test, which asserts only 1 = 1. 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.
  • Remove the unused notDeepEqual binding from tests/tests node_assert. No tests/tests source calls Node_assert.notDeepEqual or aliases the module. The binding is an external, so node_assert.mjs is unchanged.

Test plan

  • dune build
  • dune build @fmt
  • dune build --profile browser @check
  • make
  • make lib
  • no change in the runtime and Belt lib/ outputs
  • make test
  • make test-analysis
  • make test-tools
  • make test-gentype
  • make test-syntax
  • make checkformat
  • npm run check

🤖 Generated with Claude Code

cristianoc and others added 11 commits October 2, 2026 07:37
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>
@cristianoc
cristianoc requested a review from cknitt October 2, 2026 06:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T06:34:27.212721Z 8d6173d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8710

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8710

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8710

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8710

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8710

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8710

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8710

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8710

commit: 9419b6d

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

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

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.19%. Comparing base (ece8b14) to head (9419b6d).
⚠️ Report is 11 commits behind head on master.

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     

see 99 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cknitt
cknitt merged commit 8c3fecc into master Oct 3, 2026
24 checks passed
@cknitt
cknitt deleted the cristianoc/tests-runtime branch October 3, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants