Repository navigation
Add CI workflow to run tests on pull requests - #246
Merged
Merged
Conversation
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.
Summary
Adds a GitHub Actions workflow (
.github/workflows/test.yml) that runs the Jest test suite automatically on every pull request targetingmain(and on pushes tomain). This lets the repo's tests gate PRs before they're merged.What it does
pull_requestandpushtomain.npm cithennpm test(Jest viats-jest).Notes on JS + TS
The repo contains both JavaScript and TypeScript. All current test files are
*.test.tsand are executed by Jest through thets-jestpreset, sonpm testalready covers the TypeScript sources. The plain.jsfiles are example/illustration scripts without their own test files; they are still importable/runnable by the same Jest setup if.test.jsfiles are added later (Jest's defaulttestMatchpicks up both.jsand.ts).Why tests only (not
tscbuild)I intentionally did not add
npm run build:ts(fulltsc) as a required step. The build currently fails on pre-existing TypeScript errors in theleetcodeexample files (e.g. duplicate globalTreeNode/TrieNodedeclarations and script-style redeclarations). Gating PRs on the build would block every PR until those are refactored into modules. That cleanup is out of scope here — happy to tackle it in a separate PR if you'd like.Enforcing this before merge
The workflow makes the test run visible on every PR, but to actually block merging on failure you'll also need a branch protection (or ruleset) rule on
mainrequiring theTest (Node 24.x)status check to pass. I can't configure that via code — it's a repo setting. Let me know if you'd like guidance on the exact settings.