Skip to content

Commit 8f6ce9b

Browse files
attempt to remove any code jitters
1 parent da4979e commit 8f6ce9b

4 files changed

Lines changed: 15 additions & 18 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 {
@@ -26,11 +34,8 @@ export {
2634
baseBundlerIgnoreModules,
2735
isBun,
2836
} from '@temporalio/test-helpers';
29-
import {
30-
createBaseBundlerOptions,
31-
loadHistory as loadHistoryBase,
32-
saveHistory as saveHistoryBase,
33-
} from '@temporalio/test-helpers';
37+
38+
export const testTimeSkipping = RUN_TIME_SKIPPING_TESTS ? test : noopTest;
3439

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

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import { TestWorkflowEnvironment as RealTestWorkflowEnvironment } from '@tempora
77
import {
88
Worker,
99
TestWorkflowEnvironment,
10-
RUN_TIME_SKIPPING_TESTS,
11-
noopTest,
12-
test as testFromHelpers,
10+
testTimeSkipping as testTimeSkippingFromHelpers,
1311
getRandomPort,
1412
isBun,
1513
} from './helpers';
@@ -20,7 +18,7 @@ interface Context {
2018
}
2119

2220
const test = anyTest as TestFn<Context>;
23-
const testTimeSkipping = (RUN_TIME_SKIPPING_TESTS ? testFromHelpers : noopTest) as TestFn<Context>;
21+
const testTimeSkipping = testTimeSkippingFromHelpers as TestFn<Context>;
2422

2523
test.before(async (t) => {
2624
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)