temporalio / temporalio/samples-typescript

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

Open
#257 2 comments 0 reactions 1 assignee View on GitHub

@mjameswh is already working on this.

Since Mar 21, 2023.

bug
Dominant language
TypeScript
Stars
465
Forks
148
Avg merge
1d 10h
Merged PRs (30d)
11

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.