diff --git a/packages/test/src/test-ephemeral-server.ts b/packages/test/src/test-ephemeral-server.ts index 54a404cd6..a42b70461 100644 --- a/packages/test/src/test-ephemeral-server.ts +++ b/packages/test/src/test-ephemeral-server.ts @@ -147,3 +147,14 @@ test("TestEnvironment doesn't hang on fail to download", async (t) => { t.pass(); } }); + +test('TestEnvironment.createLocal correctly populates address', async (t) => { + const testEnv = await RealTestWorkflowEnvironment.createLocal(); + t.teardown(() => testEnv.teardown()); + await t.notThrowsAsync(async () => { + await Connection.connect({ + address: testEnv.address, + connectTimeout: 500, + }); + }, 'should be able to connect to test server'); +}); diff --git a/packages/testing/src/testing-workflow-environment.ts b/packages/testing/src/testing-workflow-environment.ts index 5187f996f..ce571ce51 100644 --- a/packages/testing/src/testing-workflow-environment.ts +++ b/packages/testing/src/testing-workflow-environment.ts @@ -90,7 +90,11 @@ export class TestWorkflowEnvironment { protected readonly server: native.EphemeralServer | 'existing', connection: Connection, nativeConnection: NativeConnection, - namespace: string | undefined + namespace: string | undefined, + /** + * Address used when constructing `connection` and `nativeConnection` + */ + public readonly address: string ) { this.connection = connection; this.nativeConnection = nativeConnection; @@ -238,7 +242,16 @@ export class TestWorkflowEnvironment { [InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping }, }); - return new this(runtime, optsWithDefaults, supportsTimeSkipping, server, connection, nativeConnection, namespace); + return new this( + runtime, + optsWithDefaults, + supportsTimeSkipping, + server, + connection, + nativeConnection, + namespace, + address + ); } /**