Skip to content

Conversation

@hereje
Copy link
Contributor

@hereje hereje commented Aug 29, 2025

Moving automated tests to Vitest

  • replace jest with vitest
  • remove jest references no longer used

Fixes: #228

@vercel
Copy link

vercel bot commented Aug 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
cashscript Ready Ready Preview Comment Dec 11, 2025 11:24am

- replace jest with vitest
- remove jest references no longer used
- add vitest configuration file in package
- add vitest configuration file to workspace
- replace jest with vitest
- remove jest references no longer used
- add vitest configuration file in package
- refactor extend functions so that they work
with vitest
- rename jest extensions file as `VitestExtensions.ts`
- add vitest types
- replace jest with vitest
- add vitest configuration file in package
- remove jest configuration file
- remove tests scripts from package.json
- delete tsconfig.test.json config file no longer needed
- add vitest api as global so that import is no required such as
describe, expect, it, etc.
- remove tests scripts from package.json
- delete tsconfig.test.json config file no longer needed
- add vitest api as global so that import is no required such as
describe, expect, it, etc.
- remove tests scripts from package.json
- delete tsconfig.test.json config file no longer needed
- add vitest api as global so that import is no required such as
describe, expect, it, etc.
- replace jest with vitest in examples/testing-suite
- remove jest dependencies
- install vitest dev dependency
- replace jest config files with vitest config files
- pass vitest flags to test execution
@hereje hereje force-pushed the feat/migrate-jest-to-vitest branch from 1d312b7 to 026064d Compare September 2, 2025 17:50
@hereje hereje marked this pull request as ready for review September 2, 2025 17:56
- add globals: true to vitest.config.ts on main
path of workspace
@vercel
Copy link

vercel bot commented Dec 9, 2025

@rkalis is attempting to deploy a commit to the Kalis Software Team on Vercel.

A member of the Team first needs to authorize it.

@rkalis rkalis force-pushed the feat/migrate-jest-to-vitest branch from 65c89b0 to c24889d Compare December 9, 2025 09:44
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (7aeea22) to head (f957bea).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
+ Coverage   97.42%   99.54%   +2.12%     
==========================================
  Files          76        8      -68     
  Lines       16929      222   -16707     
  Branches     1241       10    -1231     
==========================================
- Hits        16493      221   -16272     
+ Misses        426        1     -425     
+ Partials       10        0      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

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

This PR migrates the automated testing framework from Jest to Vitest across the entire monorepo, addressing issue #228. The migration includes updating test configurations, refactoring test utilities, and updating all test files to use Vitest APIs while maintaining backward compatibility for external consumers.

Key Changes

  • Replaced Jest with Vitest as the test framework across all packages (cashscript, cashc, utils) and examples
  • Updated test configurations with workspace-level vitest.config.ts and package-specific configurations
  • Migrated custom test matchers (toLog, toFailRequire, toFailRequireWith) from Jest to Vitest while maintaining compatibility through both jest/ and vitest/ export paths
  • Refactored conditional test execution from custom itOrSkip/describeOrSkip helpers to Vitest's native it.runIf/it.skipIf/describe.runIf/describe.skipIf APIs

Reviewed changes

Copilot reviewed 50 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vitest.config.ts Root workspace configuration that references package-level vitest configs
tsconfig.build.json Updated to use vitest/globals types instead of jest, upgraded lib from es2021 to es2022
packages/utils/vitest.config.ts New Vitest configuration for utils package with v8 coverage provider
packages/utils/package.json Removed Jest dependencies and scripts, added Vitest dependencies and simplified test command
packages/utils/tsconfig.test.json Removed separate test TypeScript config (no longer needed with Vitest)
packages/utils/jest.config.js Deleted Jest configuration file
packages/cashscript/vitest.config.ts New Vitest configuration for cashscript package with test setup files
packages/cashscript/vitest.setup.ts Setup file that imports TestExtensions and configures inspect depth
packages/cashscript/vitest/package.json Export configuration for vitest import path
packages/cashscript/package.json Migrated from Jest to Vitest dependencies and updated test scripts
packages/cashscript/jest/package.json Updated to reference TestExtensions for backward compatibility
packages/cashscript/jest.config.js Deleted Jest configuration file
packages/cashscript/src/test/TestExtensions.ts Refactored from JestExtensions to work with both Jest and Vitest, removed async debug() support
packages/cashscript/test/*.test.ts Updated multiple test files to use Vitest APIs (it.each, it.runIf, it.skipIf, vi.fn, vi.spyOn)
packages/cashscript/test/test-util.ts Removed custom itOrSkip and describeOrSkip helpers
packages/cashc/vitest.config.ts New Vitest configuration for cashc package
packages/cashc/vitest.setup.ts Setup file for cashc tests
packages/cashc/package.json Migrated dependencies and scripts from Jest to Vitest
packages/cashc/jest.config.js Deleted Jest configuration file
examples/testing-suite/vitest.config.ts New Vitest configuration for testing suite example
examples/testing-suite/package.json Updated dependencies and scripts for Vitest
examples/testing-suite/test/example.test.ts Updated import from 'cashscript/jest' to 'cashscript/vitest'
examples/testing-suite/artifacts/example.json Updated artifact timestamp
package.json Removed root-level Jest dependencies
jest/log-on-fail-reporter.cjs Deleted custom Jest reporter
jest/summary-reporter.cjs Deleted custom Jest reporter
.github/workflows/github-actions.yml Updated CI test command to use Vitest coverage syntax
.eslintrc.cjs Removed jest environment configuration
.eslintignore Removed dist-test directories from ignore patterns
.gitignore Removed dist-test directories (no longer generated)
.cspell.json Removed dist-test from spell check exclusions
Comments suppressed due to low confidence (1)

packages/cashscript/src/test/TestExtensions.ts:11

  • The namespace is still named 'jest' even though the codebase has migrated to Vitest. This should be updated to use Vitest's type system. Consider using Vitest's expect type extension mechanism directly or renaming the namespace to 'vitest' to better reflect the current test framework.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rkalis
Copy link
Member

rkalis commented Dec 11, 2025

Hey @hereje, thank you very much for this PR! We weren't able to get to it immediately, but this is something that we've wanted to have for a really long time and will improve our developer experience tremendously! 🫡

We have a contributor's fund to reward code contributions like yours, so if you have a BCH address, please send it to me on Telegram or X (RoscoKalis), so we can send some BCH your way!

@rkalis rkalis merged commit e2e12ba into CashScript:master Dec 11, 2025
1 check failed
@hereje
Copy link
Contributor Author

hereje commented Dec 11, 2025

Hey @hereje, thank you very much for this PR! We weren't able to get to it immediately, but this is something that we've wanted to have for a really long time and will improve our developer experience tremendously! 🫡

We have a contributor's fund to reward code contributions like yours, so if you have a BCH address, please send it to me on Telegram or X (RoscoKalis), so we can send some BCH your way!

My pleasure.

Well, I'll reach you out through X.
Happy to contribute.

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.

Move moving automated tests to Vitest

2 participants