Hi all,
I am trying to run a basic Workflow test, by following this example (which runs fine locally for me). But I am running into an error:
The error:
RUNS src/workflows.test.ts
2023-07-05T07:52:05.071583Z INFO temporal_sdk_core::ephemeral_server: Downloading https://temporal.download/assets/temporalio/sdk-java/releases/download/v1.17.0/temporal-test-server_1.17.0_macOS_amd64.tar.gz to /var/folders/5r/9_zw12cn2936_hj2wrmg88680000gn/T/temporal-test-server-sdk-typescript-1.
RUNS src/workflows.test.ts
RUNS src/workflows.test.ts
console.log
[ERROR] Worker failed
at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (src/workflows.test.ts:15:68)
at Map.forEach (<anonymous>)
FAIL src/workflows.test.ts (6.644 s)
✕ httpWorkflow with mock activity (791 ms)
● httpWorkflow with mock activity
CombinedWorkerRunError: Worker terminated with fatal error in `runUntil`
40 | );
41 |
> 42 | await worker.runUntil(async () => {
| ^
43 | const result = await client.workflow.execute(initLabResultsWorkflow, {
44 | workflowId: uuid4(),
45 | taskQueue: 'test',
at Worker.runUntil (node_modules/@temporalio/worker/src/worker.ts:1669:15)
at Object.<anonymous> (src/workflows.test.ts:42:3)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 6.673 s
Ran all test suites.
Here are the versions I am using:
"@temporalio/activity": "1.8.0",
"@temporalio/client": "1.8.0",
"@temporalio/worker": "1.8.0",
"@temporalio/workflow": "1.8.0",
"@temporalio/nyc-test-coverage": "^1.8.0",
"@temporalio/testing": "^1.8.0",
To clarify, the code is virtually identical to the sample:
test('httpWorkflow with mock activity', async () => {
const { client, nativeConnection } = testEnv;
const worker = await Worker.create(
workflowCoverage.augmentWorkerOptions({
connection: nativeConnection,
taskQueue: 'test',
workflowsPath: require.resolve('./workflows'),
activities: {
getToken: async () => '99',
},
})
);
await worker.runUntil(async () => {
const result = await client.workflow.execute(initLabResultsWorkflow, {
workflowId: uuid4(),
taskQueue: 'test',
args: [{consumerId: '123'}],
});
expect(result).toEqual('The answer is 99');
});
});
The Workflow runs fine when called with a Client.