temporalio / samples-typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Error when running the tests in activities-examples

redpanda opened this issue · comments

What are you really trying to do?

When I run npm run jest in activities-examples I got some errors.

Describe the bug

activities-examples [main] npm run jest

> temporal-activities-examples@0.1.0 jest
> jest

 PASS  src/activities/make-http-request.test.ts
2023-03-21T17:03:12.970538Z  INFO temporal_sdk_core::worker: Initializing worker task_queue=test namespace=default
2023-03-21T17:03:13.041052Z  WARN complete_workflow_activation: temporal_sdk_core::worker::workflow: Failing workflow task run_id=7d1980b6-4e96-446c-a461-5e886214ae42 failure=Failure { failure: Some(Failure { message: "Unexpected token u in JSON at position 0", source: "TypeScriptSDK", stack_trace: "undefined:1\nundefined\n^\n\nSyntaxError: Unexpected token u in JSON at position 0\n    at JSON.parse (<anonymous>)\n    at Object.concludeActivation (/Users/jleger/Projects/temporal/samples-typescript/activities-examples/node_modules/@temporalio/nyc-test-coverage/src/interceptors.ts:16:28)\n    at next (/Users/jleger/Projects/temporal/samples-typescript/activities-examples/node_modules/@temporalio/common/src/interceptors.ts:29:59)\n    at Object.concludeActivation (/Users/jleger/Projects/temporal/samples-typescript/activities-examples/node_modules/@temporalio/workflow/src/worker-interface.ts:238:23)\n    at evalmachine.<anonymous>:1:18", encoded_attributes: None, cause: None, failure_info: None }) } completion=WorkflowActivationCompletion(run_id: 7d1980b6-4e96-446c-a461-5e886214ae42, status: Failed) run_id=7d1980b6-4e96-446c-a461-5e886214ae42 task_queue=test workflow_id="0005999d-a077-46ce-b217-5bd02381856f"
 FAIL  src/workflows.test.ts (8.694 s)
  ● Console

    console.log
      [ERROR] Failed to activate workflow

      at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (src/workflows.test.ts:15:68)

    console.log
      [ERROR] Failed to activate workflow

      at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (src/workflows.test.ts:15:68)

  ● httpWorkflow with mock activity

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      27 | });
      28 |
    > 29 | test('httpWorkflow with mock activity', async () => {
         | ^
      30 |   const { client, nativeConnection } = testEnv;
      31 |   const worker = await Worker.create(
      32 |     workflowCoverage.augmentWorkerOptions({

      at Object.<anonymous> (src/workflows.test.ts:29:1)


  ● Test suite failed to run

    IllegalStateError: Cannot close connection while Workers hold a reference to it

      20 |
      21 | afterAll(async () => {
    > 22 |   await testEnv?.teardown();
         |   ^
      23 | });
      24 |
      25 | afterAll(() => {

      at NativeConnection.close (node_modules/@temporalio/worker/src/connection.ts:65:13)
      at TestWorkflowEnvironment.teardown (node_modules/@temporalio/testing/src/index.ts:292:33)
      at Object.<anonymous> (src/workflows.test.ts:22:3)

Minimal Reproduction

cd activities-examples
npm run jest

Environment/Versions

  • OS and processor: Intel Mac
  • Temporal Version: SDK 1.6.0
  • Are you using Docker or Kubernetes or building Temporal from source? No

Additional context

@mjameswh Hello I just test this issue with 1.7.0, I saw the same issue

Hi. I'm currently experiencing the same error on the hello-world folder and temporal-activities-examples@ as well. On 1.9.0