chore: consolidate test directories in packages/core (#1621)#1626
chore: consolidate test directories in packages/core (#1621)#1626miguelg719 wants to merge 3 commits intomainfrom
Conversation
Move Vitest unit tests from packages/core/tests/ to packages/core/lib/v3/tests/unit/ to consolidate all tests under a single tests directory. Changes: - Move all .test.ts files from tests/ to lib/v3/tests/unit/ - Move tests/public-api/ to lib/v3/tests/unit/public-api/ - Move tests/helpers/ to lib/v3/tests/unit/helpers/ - Update vitest.config.ts to point to new location - Update tsconfig.json to exclude unit tests from typecheck - Fix import paths in moved test files The lib/v3/tests/ directory now contains: - *.spec.ts files: Playwright integration tests (existing) - unit/: Vitest unit tests (moved) # why # what changed # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Consolidated all core tests under packages/core/tests, with unit tests in tests/unit and Playwright *.spec.ts in tests/integration, meeting Linear STG-1021’s “single tests directory” requirement. - **Refactors** - Moved lib/v3/tests/* and test/* into tests/integration and tests/unit. - Updated vitest.config include to tests/unit/**/*.test.ts. - Updated package.json scripts to use tests/integration Playwright configs. - Fixed import paths in moved test files. <sup>Written for commit 4a1e13c. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1621">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: Chromie Bot <chromie@browserbase.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 5162c7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
No issues found across 77 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Architecture diagram
sequenceDiagram
participant Dev as CI / Developer
participant NPM as package.json Scripts
participant Config as Test Configs
participant Runner as Test Runner (Vitest/Playwright)
participant Tests as Test Files
participant Core as Core Library (lib/v3)
Note over Dev,Core: PR Refactor: Consolidation of Test Directories & Import Path Updates
alt Unit Tests (Vitest)
Dev->>NPM: pnpm test:vitest
NPM->>Config: Load vitest.config.ts
Config->>Runner: CHANGED: include "tests/unit/**/*.test.ts"
Runner->>Tests: Execute Unit Tests
Tests->>Core: CHANGED: Import V3 from "../../lib/v3"
Core-->>Tests: Return Modules
Tests-->>Runner: Pass/Fail
else Integration Tests (Playwright)
Dev->>NPM: pnpm test / e2e
NPM->>Config: CHANGED: Load config from "tests/integration/..."
Note right of NPM: Was: lib/v3/tests/...
Config->>Runner: Configure Environment
Runner->>Tests: Execute *.spec.ts
Tests->>Core: CHANGED: Import V3 from "../../lib/v3"
Note right of Tests: Adjusted relative depth (was ../v3)
Core-->>Tests: Return V3 Instance
Tests-->>Runner: Pass/Fail
end
opt Typecheck
Dev->>NPM: pnpm typecheck
NPM->>Config: Load tsconfig.json
Config->>Core: CHANGED: Exclude "test/**/*" from build
end
Greptile OverviewGreptile SummaryThis PR consolidates all test files under a single Key Changes:
The reorganization is complete and consistent across all 77 files. All configuration files have been updated appropriately to reference the new test locations. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant OldStructure as Old Structure
participant NewStructure as New Structure
participant Config as Config Files
Note over OldStructure: packages/core/tests/*.test.ts<br/>packages/core/lib/v3/tests/*.spec.ts
Dev->>OldStructure: Move unit tests
OldStructure->>NewStructure: tests/*.test.ts → tests/unit/*.test.ts
Dev->>OldStructure: Move integration tests
OldStructure->>NewStructure: lib/v3/tests/*.spec.ts → tests/integration/*.spec.ts
Dev->>NewStructure: Update imports in test files
Note over NewStructure: All imports now use ../../lib/v3/
Dev->>Config: Update vitest.config.ts
Note over Config: include: tests/unit/**/*.test.ts
Dev->>Config: Update package.json
Note over Config: Playwright configs → tests/integration/
Dev->>Config: Update tsconfig.json
Note over Config: Exclude tests/**/* from typecheck
Note over NewStructure: packages/core/tests/<br/>├── integration/*.spec.ts<br/>└── unit/*.test.ts
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
why
Currently we have two test directories in core, consolidating under core/test
what changed
Move Vitest unit tests from packages/core/tests/ to packages/core/lib/v3/tests/unit/ to consolidate all tests under a single tests directory.
Changes:
Move all .test.ts files from tests/ to lib/v3/tests/unit/
Move tests/public-api/ to lib/v3/tests/unit/public-api/
Move tests/helpers/ to lib/v3/tests/unit/helpers/
Update vitest.config.ts to point to new location
Update tsconfig.json to exclude unit tests from typecheck
Fix import paths in moved test files
The lib/v3/tests/ directory now contains:
*.spec.ts files: Playwright integration tests (existing)
unit/: Vitest unit tests (moved)
test plan
Summary by cubic
Consolidated all core tests into packages/core/tests with unit tests in tests/unit and Playwright specs in tests/integration. This simplifies the layout and meets Linear STG-1021’s “single tests directory” requirement.
Written for commit 5162c7c. Summary will update on new commits. Review in cubic