Skip to content

Migrate tests to native test runner #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

risantos
Copy link
Member

Description

  • Replace jest with node:test.
  • Update minimum Node.js version to v22.14.0 and v23.4.0.
  • Adds tests GitHub Action testing v22 and v24.

- Replace `jest` with `node:test`.
- Update minimum Node.js version to `v22.14.0` and `v23.4.0`.
- Adds `tests` GitHub Action.
@risantos risantos self-assigned this May 21, 2025
@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 13:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Migrates the project’s tests from Jest to Node’s built-in test runner, updates Node version requirements, and adds a GitHub Actions workflow for testing.

  • Replace Jest with node:test, update test scripts, and move snapshots to *.snapshot alongside test files
  • Bump minimum Node.js engine to v22.14.0 (or ≥23.4.0) and update .nvmrc
  • Add CI matrix in GitHub Actions for Node v22 and v24

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/rules.test.js Converted from Jest to node:test, updated linter setup and assertions
test/rules.test.js.snapshot Added inline snapshot for node:test snapshot matching
test/fixtures/correct.js Updated “correct” fixture for React hooks and class component
test/fixtures/incorrect.js Updated “incorrect” fixture to trigger ESLint rule violations
test/snapshots/rules.test.js.snap Removed outdated Jest snapshot
package.json Updated test scripts, removed Jest dependency, and bumped Node engine
.nvmrc Changed Node version from v18.11.0 to v22.14.0
.github/workflows/tests.yaml Added CI workflow to run tests on Node v22 and v24
README.md Added badges and standardized install/test snippets
Comments suppressed due to low confidence (1)

test/fixtures/correct.js:32

  • The correct.js fixture now returns JSX in getFoo, which will trigger the react/prefer-stateless-function rule. It should be reverted to return a non-JSX value (e.g., a string) to ensure zero violations.
  getFoo = () => <div>Hello</div>;

@@ -31,6 +34,6 @@ describe('eslint-config-uphold-react', () => {
severity
}));

expect(violations).toMatchSnapshot();
test.assert.snapshot(violations);
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The node:test API does not provide test.assert.snapshot. Use the correct snapshot assertion method (e.g., test.snapshot(violations) or test.assert.matchSnapshot(violations)), otherwise this will throw.

Suggested change
test.assert.snapshot(violations);
test.assert.matchSnapshot(violations);

Copilot uses AI. Check for mistakes.

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