Skip to content

chore(tests): update import paths for test utilities#309

Merged
luxass merged 5 commits intomainfrom
prepare-internal-test-utils
Oct 10, 2025
Merged

chore(tests): update import paths for test utilities#309
luxass merged 5 commits intomainfrom
prepare-internal-test-utils

Conversation

@luxass
Copy link
Member

@luxass luxass commented Oct 10, 2025

🔗 Linked issue

resolves #297
closes #303

📚 Description

Summary by CodeRabbit

  • Documentation
    • Updated guidance to use public testing utilities and clarified notes on internal conditions helpers.
  • Tests
    • Migrated test imports to public testing utilities across the suite with no behavioral changes.
  • Chores
    • Streamlined alias configuration for testing utilities in build/test tooling.
    • Removed deprecated platform helper exports from the testing utilities public API (isLinux, isMac, isUnix, isWindows).

* Changed import paths from `#internal/test-utils` to `#test-utils` across multiple test files.
* This change simplifies the import structure and avoids the need for building test-utils during development.
* Refactored import paths for `isUnix` and `isWindows` in test files to use internal aliases.
* Removed the `conditions.ts` file as it is no longer needed.
* Updated `tsconfig.json` and `base.json` to reflect the new import structure.
* Introduced utility functions to detect the operating system.
* Functions include `isWindows`, `isMac`, `isLinux`, and `isUnix`.
@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: bac6a27

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

@github-actions github-actions bot added pkg: cli Changes related to the CLI package. pkg: ucd-store Changes related to the UCD Store package. pkg: fetch Changes related to the UCD Store package. pkg: fs-bridge Changes related to the FS Bridge package. pkg: path-utils Changes related to the Path Utils package. pkg: test-utils Changes related to the test-utils package. labels Oct 10, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2025

🌏 Preview Deployments

Application Status Preview URL
API ⏭️ Skipped N/A
Website ✅ Deployed View Preview
Documentation ✅ Deployed View Preview

Built from commit: bac6a278c5c60bf614cced94d5c790ebd977e16f


🤖 This comment will be updated automatically when you push new commits to this PR.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Repository-wide switch from internal test-utils aliases to public #test-utils for msw/mock-store, introduction of a new internal alias #internal/test-utils/conditions, removal of conditions exports from @ucdjs/test-utils, corresponding import updates in tests, alias updates in tsconfig and Vitest config, and documentation adjustments.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Updated references and examples from #internal/test-utils/* to #test-utils/*; clarified internal conditions at test/utils/ via #internal/test-utils/conditions.
Alias configuration
tooling/tsconfig/base.json, vitest.config.ts
Replaced #internal/test-utils/* aliases with #test-utils/* (mock-store, msw, base). Added #internal/test-utils/conditions pointing to test/utils/conditions.ts. Removed obsolete internal aliases.
Public API surface (test-utils)
packages/test-utils/src/index.ts
Removed re-exports for isLinux, isMac, isUnix, isWindows from public API.
Tests using msw/mock-store (alias switch)
packages/cli/test/cmd/store/init.test.ts, packages/fetch/test/index.test.ts, packages/fs-bridge/test/bridges/http.test.ts, packages/ucd-store/test/.../*.test.ts
Changed imports from #internal/test-utils/msw and #internal/test-utils/mock-store to #test-utils/msw and #test-utils/mock-store. No logic changes.
Tests using conditions (internalized)
packages/path-utils/test/security.unix.test.ts, packages/path-utils/test/security.windows.test.ts
Updated imports to use #internal/test-utils/conditions for isUnix/isWindows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I nibbled the paths, made aliases neat,
Hopped tests to public burrows, a tidy feat.
Conditions now tucked in a warren inside,
The API slimmer—light as a glide.
With msw and mocks in fields of green,
Our suite now runs swift, serene. 🐇✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch prepare-internal-test-utils

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3166dd and bac6a27.

📒 Files selected for processing (19)
  • AGENTS.md (3 hunks)
  • packages/cli/test/cmd/store/init.test.ts (1 hunks)
  • packages/fetch/test/index.test.ts (1 hunks)
  • packages/fs-bridge/test/bridges/http.test.ts (1 hunks)
  • packages/path-utils/test/security.unix.test.ts (1 hunks)
  • packages/path-utils/test/security.windows.test.ts (1 hunks)
  • packages/test-utils/src/index.ts (0 hunks)
  • packages/ucd-store/test/core/init.test.ts (1 hunks)
  • packages/ucd-store/test/file-operations/capability-requirements.test.ts (1 hunks)
  • packages/ucd-store/test/file-operations/file-paths.test.ts (1 hunks)
  • packages/ucd-store/test/file-operations/file-tree.test.ts (1 hunks)
  • packages/ucd-store/test/file-operations/get-file.test.ts (1 hunks)
  • packages/ucd-store/test/internal/files.test.ts (1 hunks)
  • packages/ucd-store/test/maintenance/analyze.test.ts (1 hunks)
  • packages/ucd-store/test/maintenance/clean.test.ts (1 hunks)
  • packages/ucd-store/test/maintenance/mirror.test.ts (1 hunks)
  • packages/ucd-store/test/maintenance/repair.test.ts (1 hunks)
  • tooling/tsconfig/base.json (1 hunks)
  • vitest.config.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@luxass luxass marked this pull request as ready for review October 10, 2025 06:06
Copilot AI review requested due to automatic review settings October 10, 2025 06:06
Copy link
Contributor

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 updates import paths for test utilities by changing from #internal/test-utils to #test-utils for the main test utilities, while introducing a new #internal/test-utils/conditions alias for OS condition checks. This refactoring improves the organization and clarity of test utility imports.

  • Renamed the main test utility import aliases from #internal/test-utils/* to #test-utils/*
  • Added a new #internal/test-utils/conditions alias for OS condition utilities
  • Updated all test files to use the new import paths
  • Moved OS condition exports out of the main test-utils package

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vitest.config.ts Updated alias configuration to use #test-utils and added #internal/test-utils/conditions
tooling/tsconfig/base.json Updated TypeScript path mappings to match new alias structure
packages/ucd-store/test/**.test.ts Updated imports from #internal/test-utils to #test-utils
packages/test-utils/tsconfig.json Added conditions.ts to include array
packages/test-utils/src/index.ts Removed OS condition exports
packages/path-utils/test/**.test.ts Updated to use #internal/test-utils/conditions for OS checks
packages/fs-bridge/test/**.test.ts Updated imports to use #test-utils
packages/fetch/test/**.test.ts Updated imports to use #test-utils
packages/cli/test/**.test.ts Updated imports to use #test-utils
AGENTS.md Updated documentation to reflect new import paths

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@luxass luxass merged commit 316abf7 into main Oct 10, 2025
9 checks passed
@luxass luxass deleted the prepare-internal-test-utils branch October 10, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: cli Changes related to the CLI package. pkg: fetch Changes related to the UCD Store package. pkg: fs-bridge Changes related to the FS Bridge package. pkg: path-utils Changes related to the Path Utils package. pkg: test-utils Changes related to the test-utils package. pkg: ucd-store Changes related to the UCD Store package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move test-utils conditions to root test setup files

1 participant