-
Notifications
You must be signed in to change notification settings - Fork 158
chore: break up test package #1910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 // |
There was a problem hiding this comment.
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
7a9f1f9 to
6c2ada0
Compare
|
Moving to draft until I resolve some rebase issues |
What was changed
Break up the
testpackage so tests for specific packages reside in the package.As part of this, we also changed how each package gets built. Previously
pnpm run buildworked as buildingtestwould 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
Closes N/A
How was this tested:
pnpm run testAny docs updates needed?
N/A