Repository navigation
test(srcts): Replay the sample logs in a Node test - #155
Merged
schloerke merged 3 commits intoOct 20, 2026
Merged
Conversation
srcts/__tests__/graphReplay.test.ts runs each log in inst/log-files/ through GraphAtStep and checks the step lists and the node and edge counts at the first, middle, and last visible step. `npm test` bundles it with esbuild and runs it with node --test; `npm run build` (and so CI's routine job) runs it too.
schloerke
added this pull request to stack #153
October 20, 2026 18:12
Newer Node (CI uses the current release) treats `node --test` arguments as globs, and globs skip node_modules/, so it could not find the bundle. Running the file directly still reports through node:test and exits 1 on failure.
…es out of app code - Split tsconfig: app code no longer sees @types/node; tsconfig.test.json adds the tests - Fingerprint each checked step from what cytoscape draws, so wrong statuses fail - Filter on the first node and check the filtered steps and graph - Number steps with initStep() instead of a copy - Ignore non-.js files in inst/log-files/ and find it from the bundle's folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the first JS test.
srcts/__tests__/graphReplay.test.tsreplays each of the 5 logs ininst/log-files/throughGraphAtStep. It checks four step lists (visible, idle, output calc, and user mark steps). At the first, middle, and last visible step, it checks the node, edge, and unique-edge counts plus a fingerprint: a short hash of each element's key, classes, and label, which is what cytoscape draws. It then filters on the first node and checks the filtered steps and the filtered graph. It uses Node's built-innode:test, and the only new dependency is@types/node.npm testbundles the test with esbuild intonode_modules/.cache/and runs it with plainnode, which takes about 0.2 seconds. (node --testfails on current Node, which treats the path as a glob and skipsnode_modules/.)npm run buildnow runs it too, so CI'sroutinejob runs it as well.tsconfig.jsonleavessrcts/__tests__/out, andtsconfig.test.jsonadds the tests with Node types, so app code still cannot use Node globals.npm run typecheckruns both. The graph modules readwindowwhen they load, sosetupWindow.tssets up a minimal stub first.log/initStep.tsnow exportsinitStep(), so the test numbers steps the same way the app does.The expected values come from the current code, which matches the
mainbundle in the browser comparison from rstudio/reactlog#154. To confirm the test catches real breakage, I removed the edge-delete line inGraph.addEntry, and all 5 replay tests failed. I also removed oneinvalidateStatus.toFinished()call: the counts stayed the same, and the fingerprints failed for all 5 logs. Adding a log file without adding its values also fails.memory-bank/jsBuild.mdexplains how to update the values.