Skip to content

Migrate from Jest to Node.js native test runner - #336

Merged
RomiC merged 5 commits into
masterfrom
migrate-to-node-test-runner
Aug 7, 2026
Merged

Migrate from Jest to Node.js native test runner#336
RomiC merged 5 commits into
masterfrom
migrate-to-node-test-runner

Conversation

@RomiC

@RomiC RomiC commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Replace Jest with Node.js built-in test runner (node:test, node:assert/strict) and c8 for coverage. Also migrate from ESLint+Prettier to Oxlint+Oxfmt. Removes ~395 transitive dependencies.

Changes

Jest → node:test

  • Replace jest.mock() with mock.method() from node:test
  • Replace expect() assertions with node:assert/strict
  • Replace jest.fn() with mock.fn()
  • Rewrite feature test with async/await + Promise wrappers
  • Delete jest.config.js, __mocks__/ directory
  • Update CI workflow (npm run test:coverage, pin coveralls to v2.3.8)
  • Update pre-push hook to use node --test

ESLint → Oxlint

  • Replace eslint, eslint-config-prettier, eslint-plugin-prettier, prettier with oxlint + oxfmt
  • Add oxlint.config.mjs and oxfmt.config.mjs (matching ya-disk project)
  • Delete .eslintrc and .prettierrc
  • Fix deprecated husky install command

Results

  • 7 tests passing (5 unit + 2 integration)
  • 100% coverage (100% branch — up from 70% with Jest)
  • ~395 dev dependencies removed
  • 0 vulnerabilities (down from 12)

RomiC added 3 commits August 5, 2026 16:16
- Remove jest (306 transitive dependencies)
- Add c8 12.0.0 for coverage collection
- Update test script to use node --test
- Add test:coverage script with lcov/clover reporters
- Remove unused codecov CLI coverage script
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

The PR replaces Jest with Node.js’s native test runner and c8 while updating test mocks, coverage reporting, CI, linting, and pre-push execution.

  • Migrates unit and integration tests to node:test and node:assert/strict.
  • Replaces Jest mocks with native mock APIs and removes Jest-specific configuration and fixtures.
  • Moves integration-test output creation into suite setup so skipped tokenless runs no longer leave generated files.
  • Updates package dependencies, scripts, CI coverage reporting, and development hooks.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported tokenless-run artifact is fixed because the output stream is now created only in the skipped suite's setup hook, and no blocking failure remains.

Important Files Changed

Filename Overview
features/upload-and-download-file.feature.js Migrates the integration suite to native test APIs and fixes the previously reported skipped-suite artifact by deferring output-file creation to the suite's before hook.
package.json Replaces Jest scripts and dependencies with the Node.js test runner and c8 coverage.
specs/download.spec.js Rewrites download tests using native assertions and scoped method mocks.
specs/followRedirect.spec.js Rewrites redirect tests using native test and mock APIs.
specs/upload.spec.js Rewrites upload tests using native assertions and scoped method mocks.
.github/workflows/npm-test.yml Runs the coverage test command in CI and pins the Coveralls action version.

Reviews (3): Last reviewed commit: "Chore: Update CI workflow and pre-push h..." | Re-trigger Greptile

Comment thread features/upload-and-download-file.feature.js Outdated
@coveralls

coveralls commented Aug 6, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 100.0% (+9.4%) from 90.625% — migrate-to-node-test-runner into master

- Replace jest.mock() with mock.method() from node:test
- Replace expect() assertions with node:assert/strict
- Replace jest.fn() with mock.fn()
- Rewrite feature test to use async/await and Promise wrappers
- Add describe.skip guard for Dependabot in feature test
- Remove jest.unmock() call from feature test
- Bump ecmaVersion to 2022, add node:test globals to eslintrc
- Relax space-before-function-paren to avoid Prettier conflicts
@RomiC
RomiC force-pushed the migrate-to-node-test-runner branch from ce223b1 to 48a5ebf Compare August 6, 2026 15:21
@RomiC RomiC self-assigned this Aug 6, 2026
@RomiC RomiC added dx Changes relative to the Developer eXperience tests Test improvements dependencies Pull requests that update a dependency file labels Aug 6, 2026
- Switch CI from npm test to npm run test:coverage for lcov output
- Pin coverallsapp/github-action to v2.3.8
- Replace npm test with node --test in pre-push hook
@RomiC
RomiC force-pushed the migrate-to-node-test-runner branch from 48a5ebf to e2e733e Compare August 7, 2026 06:57
@RomiC
RomiC merged commit 5b14c54 into master Aug 7, 2026
8 checks passed
@RomiC
RomiC deleted the migrate-to-node-test-runner branch August 7, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file dx Changes relative to the Developer eXperience tests Test improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants