Workflow Testing Framework violates typescript checks? "duplicate name 'ActivityHeartbeat' in Namespace coresdk"

Hello, I’m trying to run a simple workflow test and I find that there are linting and typescript errors when using the @temporalio/testing module.

So far, I’m faced with two issues and this post is about the second issue. The first issue is Workflow Testing Framework violates typescript checks? @temporalio/worker/lib/connection").NativeConnection is not assignable to type @temporalio/testing/node_modules/@temporalio/worker/lib/connection").NativeConnection

This topic’s issue is the error “duplicate name ‘ActivityHeartbeat’ in Namespace coresdk" when trying to execute my simple workflow test.

FAIL test/workflows/my-workflow.test.ts
  ● Test suite failed to run

    duplicate name 'ActivityHeartbeat' in Namespace coresdk

      1 | import { TestWorkflowEnvironment } from '@temporalio/testing';
    > 2 | import { Worker, WorkerOptions } from '@temporalio/worker';
        | ^
      3 | import { v4 as uuid4 } from 'uuid';
      4 | import { WorkflowCoverage } from '@temporalio/nyc-test-coverage';

      at Namespace.add (node_modules/protobufjs/src/namespace.js:239:23)
      at Root.add (node_modules/protobufjs/src/namespace.js:232:28)
      at Root.addJSON (node_modules/protobufjs/src/namespace.js:172:16)
      at Object.<anonymous> (node_modules/@temporalio/proto/protos/json-module.js:7:2)
      at Object.<anonymous> (node_modules/@temporalio/proto/protos/root.js:8:23)
      at Object.<anonymous> (node_modules/@temporalio/proto/protos/index.js:1:38)
      at Object.<anonymous> (node_modules/@temporalio/worker/src/runtime.ts:23:1)
      at Object.<anonymous> (node_modules/@temporalio/worker/src/connection.ts:5:1)
      at Object.<anonymous> (node_modules/@temporalio/worker/src/index.ts:23:1)
      at Object.<anonymous> (test/workflows/my-workflow.test.ts:2:1)

Any advice is appreciated. Thank you!

Same as in your other post, this is due to having multiple copies of packages. In this case, its about @temporalio/proto. Possibly because you import different versions @temporalio/* packages.

Just to close the thread on this issue as well…

The problem was that I installed the temporal packages right in-between upgrades so some were on 1.7 while others were on 1.8. A bit more detail can be seen on Workflow Testing Framework violates typescript checks? @temporalio/worker/lib/connection").NativeConnection is not assignable to type @temporalio/testing/node_modules/@temporalio/worker/lib/connection").NativeConnection - #4 by Matthias