Skip to content

Commit 6f321cd

Browse files
attempt to remove any code jitters
1 parent 9fc27d1 commit 6f321cd

4 files changed

Lines changed: 15 additions & 23 deletions

File tree

packages/test/src/helpers.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import asyncRetry from 'async-retry';
44
import { v4 as uuid4 } from 'uuid';
55
import { Client, Connection } from '@temporalio/client';
66
import * as iface from '@temporalio/proto';
7+
import {
8+
createBaseBundlerOptions,
9+
loadHistory as loadHistoryBase,
10+
saveHistory as saveHistoryBase,
11+
RUN_TIME_SKIPPING_TESTS,
12+
test,
13+
noopTest,
14+
} from '@temporalio/test-helpers';
715

816
// Re-export from test-helpers
917
export {
@@ -24,11 +32,8 @@ export {
2432
Worker,
2533
TestWorkflowEnvironment,
2634
} from '@temporalio/test-helpers';
27-
import {
28-
createBaseBundlerOptions,
29-
loadHistory as loadHistoryBase,
30-
saveHistory as saveHistoryBase,
31-
} from '@temporalio/test-helpers';
35+
36+
export const testTimeSkipping = RUN_TIME_SKIPPING_TESTS ? test : noopTest;
3237

3338
/**
3439
* Package-specific bundler options that include local activity and mock-native-worker modules.

packages/test/src/test-ephemeral-server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,15 @@ import { v4 as uuid4 } from 'uuid';
44
import { bundleWorkflowCode, WorkflowBundle } from '@temporalio/worker';
55
import { Connection } from '@temporalio/client';
66
import { TestWorkflowEnvironment as RealTestWorkflowEnvironment } from '@temporalio/testing';
7-
import {
8-
Worker,
9-
TestWorkflowEnvironment,
10-
RUN_TIME_SKIPPING_TESTS,
11-
noopTest,
12-
test as testFromHelpers,
13-
getRandomPort,
14-
} from './helpers';
7+
import { Worker, TestWorkflowEnvironment, testTimeSkipping as anyTestTimeSkipping, getRandomPort } from './helpers';
158

169
interface Context {
1710
bundle: WorkflowBundle;
1811
taskQueue: string;
1912
}
2013

2114
const test = anyTest as TestFn<Context>;
22-
const testTimeSkipping = (RUN_TIME_SKIPPING_TESTS ? testFromHelpers : noopTest) as TestFn<Context>;
15+
const testTimeSkipping = anyTestTimeSkipping as TestFn<Context>;
2316

2417
test.before(async (t) => {
2518
t.context.bundle = await bundleWorkflowCode({ workflowsPath: require.resolve('./workflows') });

packages/test/src/test-testenvironment-timeskipping.ts renamed to packages/test/src/test-testenvironment.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { v4 as uuid4 } from 'uuid';
44
import { WorkflowFailedError } from '@temporalio/client';
55
import { bundleWorkflowCode, WorkflowBundleWithSourceMap } from '@temporalio/worker';
66
import { workflowInterceptorModules } from '@temporalio/testing';
7-
import { RUN_TIME_SKIPPING_TESTS, test, noopTest, Worker, TestWorkflowEnvironment } from './helpers';
7+
import { Worker, TestWorkflowEnvironment, testTimeSkipping } from './helpers';
88
import {
99
assertFromWorkflow,
1010
asyncChildStarter,
@@ -14,8 +14,6 @@ import {
1414
waitOnSignalWithTimeout,
1515
} from './workflows/testenv-test-workflows';
1616

17-
const testTimeSkipping = RUN_TIME_SKIPPING_TESTS ? test : (noopTest as unknown as typeof test);
18-
1917
interface Context {
2018
testEnv: TestWorkflowEnvironment;
2119
bundle: WorkflowBundleWithSourceMap;

packages/test/src/workflows/testenv-test-workflows.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Workflows used in `test-testenvironment-timeskipping.ts`
2+
* Workflows used in `test-testenvironment.ts`
33
* @module
44
*/
55

@@ -9,11 +9,7 @@ import { sleep, proxyActivities, defineSignal, setHandler, startChild } from '@t
99
// Export sleep to be invoked as a workflow
1010
export { sleep };
1111

12-
interface Activities {
13-
sleep(duration: number): Promise<void>;
14-
}
15-
16-
const activities = proxyActivities<Activities>({ startToCloseTimeout: 2_000_000 });
12+
const activities = proxyActivities({ startToCloseTimeout: 2_000_000 });
1713
export const unblockSignal = defineSignal<[]>('unblock');
1814

1915
export async function raceActivityAndTimer(expectedWinner: 'timer' | 'activity'): Promise<string> {

0 commit comments

Comments
 (0)