temporalio / temporalio/sdk-typescript
[Bug] Jest detects open handles
Open
@mjameswh is already working on this.
Since Oct 26, 2022.
bug
- Dominant language
- TypeScript
- Stars
- 917
- Forks
- 224
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 43
Description
Getting this warning when running a simple test with the test environment:
$ ./node_modules/.bin/jest --detectOpenHandles
...
Jest has detected the following 1 open handle potentially keeping Jest from exiting:
● neon threadsafe function
...
Code for reproduction:
import { TestWorkflowEnvironment } from '@temporalio/testing';
import { Worker, Runtime, DefaultLogger, LogEntry } from '@temporalio/worker';
import { someWorkflow } from './workflows';
let testEnv: TestWorkflowEnvironment;
beforeAll(async () => {
// Use console.log instead of console.error to avoid red output
// Filter INFO log messages for clearer test output
Runtime.install({
logger: new DefaultLogger('WARN', (entry: LogEntry) => console.log(`[${entry.level}]`, entry.message)),
});
testEnv = await TestWorkflowEnvironment.createTimeSkipping();
});
afterAll(async () => {
await testEnv?.teardown();
});
test('some random test', async () => {
const { client, nativeConnection } = testEnv;
const worker = await Worker.create({
connection: nativeConnection,
taskQueue: 'test',
workflowsPath: require.resolve('./workflows'),
activities: {
// ...
},
});
await worker.runUntil(async () => {
const result = await client.workflow.execute(someWorkflow, {
args: [],
workflowId: 'money-transfer-test-workflow',
taskQueue: 'test',
});
expect(result).toEqual('test');
});
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.