Skip to content

Conversation

@endersonmaia
Copy link
Contributor

@endersonmaia endersonmaia commented Jan 9, 2026

This pull request migrates the apps/cli integration and unit tests from Vitest to Bun's native test runner, and updates the test infrastructure to improve reliability and maintainability. It also updates the test Docker image handling to ensure required images are available before running integration tests, and modernizes the coverage reporting in the CI workflow.

Test runner migration and improvements:

  • Replaced all usage of Vitest in integration and unit tests with Bun's test runner, updating imports and test APIs accordingly across all test files. (apps/cli/tests/integration/builder/directory.test.ts, apps/cli/tests/integration/builder/docker.test.ts, apps/cli/tests/integration/builder/empty.test.ts, apps/cli/tests/integration/builder/none.test.ts, apps/cli/tests/integration/builder/tar.test.ts, apps/cli/tests/integration/exec/cartesi-machine.test.ts, apps/cli/tests/integration/exec/genext2fs.test.ts, apps/cli/tests/integration/exec/mksquashfs.test.ts, apps/cli/tests/unit/config.test.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Removed the vitest dependency from package.json and updated the test script to use bun test instead. (apps/cli/package.json) [1] [2]

Test infrastructure and Docker image handling:

  • Added a global setup function, setupIntegrationTests, to ensure required Docker images are present before running integration tests, improving test reliability and developer experience. (apps/cli/tests/integration/config.ts)

  • Updated all integration tests to call setupIntegrationTests in a beforeAll hook, ensuring Docker images are prepared before any tests run. (apps/cli/tests/integration/builder/directory.test.ts, apps/cli/tests/integration/builder/docker.test.ts, apps/cli/tests/integration/builder/empty.test.ts, apps/cli/tests/integration/builder/none.test.ts, apps/cli/tests/integration/builder/tar.test.ts, apps/cli/tests/integration/exec/cartesi-machine.test.ts, apps/cli/tests/integration/exec/genext2fs.test.ts, apps/cli/tests/integration/exec/mksquashfs.test.ts) [1] [2] [3] [4] [5] [6] [7] [8]

  • Updated the test SDK image constant to use values from the main config, ensuring consistency across environments. (apps/cli/tests/integration/config.ts)

Temporary directory management for tests:

  • Replaced the custom tmpdirTest Vitest fixture with a new setupTempDir helper for managing temporary directories in Bun tests, and updated all affected tests to use this new approach. (apps/cli/tests/integration/builder/tmpdirTest.ts, and all integration test files) [1] [2] [3] [4] [5] [6]

CI workflow and coverage reporting:

  • Updated the GitHub Actions workflow to use Bun's built-in coverage reporter and switched to a Bun-compatible coverage reporting action, removing the Vitest-specific coverage action. (.github/workflows/cli.yaml)

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

⚠️ No Changeset found

Latest commit: acbc9bd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tuler tuler changed the title Feature/bun test bun test Jan 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 92.99% (🎯 0%) 756 / 813
🔵 Statements 92.99% 756 / 813
🔵 Functions 93.33% 70 / 75
🔵 Branches 0% 0 / 0
📁 File Coverage (13 files)
File Lines Statements Functions Branches Uncovered Lines
apps/cli/src/builder/directory.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/docker.ts 🟢 88.68% 🟢 88.68% 🟡 75% 🔴 0% 83-85, 139-147
apps/cli/src/builder/empty.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/none.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/tar.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/config.ts 🟢 92.63% 🟢 92.63% 🟢 94.12% 🔴 0% 65-66, 217, 226, 235, 255, ...
apps/cli/src/exec/cartesi-machine.ts 🟡 75% 🟡 75% 🟡 66.67% 🔴 0% 10-12, 28-30
apps/cli/src/exec/genext2fs.ts 🟢 96.92% 🟢 96.92% 🟢 100% 🔴 0% 87-88
apps/cli/src/exec/index.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/exec/mksquashfs.ts 🟢 91.23% 🟢 91.23% 🟢 100% 🔴 0% 68-72
apps/cli/src/exec/util.ts 🟢 94.44% 🟢 94.44% 🟢 100% 🔴 0% 47-48
...sts/integration/builder/tmpdirTest.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/tests/integration/config.ts 🟢 91.3% 🟢 91.3% 🟢 100% 🔴 0% 29-30

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 CLI test suite from Vitest to Bun's built-in test runner. The migration includes updating test imports, refactoring the temporary directory handling pattern, adding integration test setup for Docker images, and updating the CI workflow for Bun-based coverage reporting.

Key changes:

  • Replaced Vitest with Bun test runner across all test files
  • Refactored temporary directory fixture pattern from Vitest's test.extend to a helper function approach
  • Added setupIntegrationTests() function to ensure Docker images are available before tests run

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
bun.lock Updated tinyexec version and removed vitest-related dependencies
apps/cli/package.json Removed vitest dependency and updated test script to use bun test
apps/cli/tests/unit/config.test.ts Updated imports from vitest to bun:test
apps/cli/tests/integration/exec/*.test.ts Updated imports and added beforeAll hook for integration test setup
apps/cli/tests/integration/config.ts Added Docker image setup utilities for integration tests
apps/cli/tests/integration/builder/tmpdirTest.ts Refactored from Vitest fixture pattern to helper function pattern
apps/cli/tests/integration/builder/*.test.ts Updated imports, added beforeAll hooks, and migrated from tmpdirTest fixture to setupTempDir helper
.github/workflows/cli.yaml Updated test command and coverage reporting to use Bun-native tools

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants