Skip to content

Conversation

@chris-olszewski
Copy link
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

chris-olszewski and others added 15 commits January 22, 2026 12:23
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>

- name: Compile code
run: pnpm --recursive --stream --filter '!@temporalio/core-bridge' --filter '!typescript-sdk' run build
# Temporary measure to work around PNPM installs of local packages
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't love this, but this is to avoid making the PR even more invasive.

Crux of the issue is with how pnpm install works for workspace protocol. If the lib for our internal packages is not present at install time it doesn't get symlinked. This results in tests failing as they can't find the lib/index.js entry point. The second install after build fixes this since pnpm will properly link the lib dir now that it exists.

A proper fix would be leveraging something like publishConfig to use a different entrypoint for dev vs what we ship.

"@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
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
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
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
Member Author

Moving to draft until I resolve some rebase issues

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