Skip to content

chore: break up test package#1910

Open
chris-olszewski wants to merge 17 commits intomainfrom
olszewski/break_up_build
Open

chore: break up test package#1910
chris-olszewski wants to merge 17 commits intomainfrom
olszewski/break_up_build

Conversation

@chris-olszewski
Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski commented Jan 22, 2026

What was changed

Break up the test package so tests for specific packages reside in the package.

As part of this, we also changed how each package gets built. Previously pnpm run build worked as building test would end up building every package it depended upon. As we no longer expect this to always hold, we now have each package build itself.

In order to keep this PR more reviewable, I avoided breaking up any test files and only moved entire files where they were applicable. There's certainly more work that can be done for breaking up test, but this suits our most purposes for the moment.

Why?

As we introduce support for OTEL v2, we will need to test both v1 and v2 of OTEL. The easiest way to achieve this is by having separate packages for each. In order to support this each package needs to own it's own tests.

Checklist

  1. Closes N/A

  2. How was this tested:
    pnpm run test

  3. Any docs updates needed?
    N/A

Comment thread .github/workflows/ci.yml Outdated
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-lib-instrument": "^1.7.7",
"@types/webpack": "^5.28.5",
"typescript": "^5.6.3",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to specify TS version as otherwise ts-loader grabs a different TS version than the rest of the repo and the latest version has some type signatures changed resulting in failed compilation.

noopTest,
} from '@temporalio/test-helpers';

// Re-export from test-helpers
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-exporting here just so reviewing this PR has less noise from a bunch of import changes

import { test as anyTest, Worker, TestWorkflowEnvironment, BaseContext, helpers } from '@temporalio/test-helpers';
import { bundlerOptions } from './helpers';

// FIXME MOVE THIS SECTION SOMEWHERE IT CAN BE SHARED //
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed like as good a time as any to fix this

@chris-olszewski chris-olszewski force-pushed the olszewski/break_up_build branch from 7a9f1f9 to 6c2ada0 Compare January 28, 2026 21:37
@chris-olszewski chris-olszewski marked this pull request as ready for review January 29, 2026 14:02
@chris-olszewski chris-olszewski requested a review from a team as a code owner January 29, 2026 14:02
@chris-olszewski chris-olszewski marked this pull request as draft February 11, 2026 16:03
@chris-olszewski
Copy link
Copy Markdown
Member Author

Moving to draft until I resolve some rebase issues

chris-olszewski and others added 16 commits February 23, 2026 20:10
Add `"build": "tsc --build"` to packages that were missing it,
enabling independent package builds with `pnpm -F <pkg> run build`.

Packages updated:
- @temporalio/common
- @temporalio/client
- @temporalio/workflow
- @temporalio/activity
- @temporalio/worker
- @temporalio/testing
- @temporalio/nexus
- @temporalio/cloud
- @temporalio/envconfig
- @temporalio/plugin
- @temporalio/interceptors-opentelemetry
- @temporalio/ai-sdk
- @temporalio/nyc-test-coverage
- temporalio (meta)

Also adds common reference to nyc-test-coverage tsconfig and
updates proto build script to include TypeScript compilation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move tests that only depend on @temporalio/common to enable
independent testing of the common package.

Moved tests:
- test-time.ts
- test-type-helpers.ts
- test-enums-helpers.ts
- test-retry-policy.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move tests that only depend on their respective packages to enable
independent testing.

@temporalio/common:
- test-parse-uri.ts (moved from test)

@temporalio/nexus:
- test-nexus-link-converter.ts
- test-nexus-token-helpers.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move the following tests from packages/test to their respective packages:
- test-envconfig.ts -> packages/envconfig/src/__tests__/
- test-mockactivityenv.ts -> packages/testing/src/__tests__/
- test-flags.ts -> packages/workflow/src/__tests__/

Each package now has:
- ava as a devDependency
- A "test" script to run package-specific tests
- AVA configuration in package.json

Also updates nexus test imports and nyc-test-coverage tsconfig.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move test files to their respective packages to enable independent
testing, following the self-contained test fixtures pattern.

Moved to @temporalio/testing:
- test-testenvironment.ts (with testenv-test-workflows.ts)

Moved to @temporalio/ai-sdk:
- test-ai-sdk.ts (with workflows/ai-sdk.ts, activities/ai-sdk.ts)

Each package now has its own test infrastructure:
- AVA configuration in package.json
- Test script: pnpm -F <package> run test
- Self-contained test workflows and activities

Also added docs/future-plan-test-extraction.md documenting the
pattern for moving additional integration tests in the future.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chris-olszewski chris-olszewski force-pushed the olszewski/break_up_build branch from 6c2ada0 to bbed7cf Compare February 24, 2026 01:59
@chris-olszewski chris-olszewski marked this pull request as ready for review February 24, 2026 14:51
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.

1 participant