Skip to content

Run the tests in JavaScript in CI - #39

Closed
leonitousconforti wants to merge 10 commits into
mainfrom
fable-tests
Closed

leonitousconforti wants to merge 10 commits into
mainfrom
fable-tests

Conversation

@leonitousconforti

@leonitousconforti leonitousconforti commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

CI's fable job now compiles the test suite with Fable against the packed library and runs it on Node, so a runtime difference from .NET in what the tests cover fails CI rather than slipping through. This no longer builds on #38: flip7 leaves matching .NET to Fable, and the tests that fail in JavaScript until a Fable fix ships are listed in test/Fable.fs with that fix.

  • test/Fable.fs, compiled only under Fable, stands in for the parts of xunit and FsCheck the tests use, with SHA-256 for the game digests and an Async.RunSynchronously that drains Fable's trampoline
  • test/FableEntry.fsx writes the git-ignored entry that calls every Fact and Theory case. It stops at any test attribute or #if it cannot read
  • 147 of the 174 cases run in JavaScript. LookaheadTests and PersistenceTests are left out, and cases that play on a Recording (Fable cannot inherit System.Random) or use a task timeout sit behind #ifs
  • The tests compile against the nupkg at that exact version, so the job also checks the package works for a Fable consumer. The package gains the fable, fable-library, fable-javascript and fable-dotnet tags
  • From Deal and write the same in JavaScript as on .NET #38 it keeps the tests that a draw takes the card FSharp.Core's shuffle puts first, that a second chance goes to the first of a tie, that floats are written as ToString("R") writes them, and that 0.00001 is read

Expected failures on Fable 5.27.0: only the second chance tie test, until fable-compiler/Fable#5198 (minBy keeps the first tie) ships. A listed test counts only if it fails the listed way; any other failure, a listed test that passes and one that did not run fail the run, so the Fable bump that ships it must drop the entry.

Checked: fantomas, Release build, 174 .NET tests. Under jsc with Fable 5.27.0: 146 passed, 1 failed as listed, 0 wrong. Node first runs in CI.

@leonitousconforti

Copy link
Copy Markdown
Owner Author

Closing in favor of #47, which keeps the .NET tests worth having from here, and #48, which checks the JavaScript build by running one small program on .NET and on Node and diffing what they print. Together they cover what this caught with far less bridge code.

@leonitousconforti
leonitousconforti deleted the fable-tests branch November 6, 2026 20:51
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.

1 participant