@@ -2,9 +2,8 @@ import * as process from 'process';
22import { TestFn } from 'ava' ;
33import { v4 as uuid4 } from 'uuid' ;
44import { WorkflowFailedError } from '@temporalio/client' ;
5- import { bundleWorkflowCode , WorkflowBundleWithSourceMap } from '@temporalio/worker' ;
65import { workflowInterceptorModules } from '@temporalio/testing' ;
7- import { Worker , TestWorkflowEnvironment , testTimeSkipping } from './helpers ' ;
6+ import { bundleWorkflowCode , WorkflowBundleWithSourceMap } from '@temporalio/worker ' ;
87import {
98 assertFromWorkflow ,
109 asyncChildStarter ,
@@ -13,15 +12,16 @@ import {
1312 unblockSignal ,
1413 waitOnSignalWithTimeout ,
1514} from './workflows/testenv-test-workflows' ;
15+ import { Worker , TestWorkflowEnvironment , testTimeSkipping as anyTestTimeSkipping } from './helpers' ;
1616
1717interface Context {
1818 testEnv : TestWorkflowEnvironment ;
1919 bundle : WorkflowBundleWithSourceMap ;
2020}
2121
22- const test_ = testTimeSkipping as TestFn < Context > ;
22+ const testTimeSkipping = anyTestTimeSkipping as TestFn < Context > ;
2323
24- test_ . before ( async ( t ) => {
24+ testTimeSkipping . before ( async ( t ) => {
2525 t . context = {
2626 testEnv : await TestWorkflowEnvironment . createTimeSkipping ( ) ,
2727 bundle : await bundleWorkflowCode ( {
@@ -31,28 +31,31 @@ test_.before(async (t) => {
3131 } ;
3232} ) ;
3333
34- test_ . after . always ( async ( t ) => {
34+ testTimeSkipping . after . always ( async ( t ) => {
3535 await t . context . testEnv ?. teardown ( ) ;
3636} ) ;
3737
38- test_ . serial ( 'TestEnvironment sets up test server and is able to run a Workflow with time skipping' , async ( t ) => {
39- const { client, nativeConnection } = t . context . testEnv ;
40- const worker = await Worker . create ( {
41- connection : nativeConnection ,
42- taskQueue : 'test' ,
43- workflowBundle : t . context . bundle ,
44- } ) ;
45- await worker . runUntil (
46- client . workflow . execute ( sleep , {
47- workflowId : uuid4 ( ) ,
38+ testTimeSkipping . serial (
39+ 'TestEnvironment sets up test server and is able to run a Workflow with time skipping' ,
40+ async ( t ) => {
41+ const { client, nativeConnection } = t . context . testEnv ;
42+ const worker = await Worker . create ( {
43+ connection : nativeConnection ,
4844 taskQueue : 'test' ,
49- args : [ 1_000_000 ] ,
50- } )
51- ) ;
52- t . pass ( ) ;
53- } ) ;
45+ workflowBundle : t . context . bundle ,
46+ } ) ;
47+ await worker . runUntil (
48+ client . workflow . execute ( sleep , {
49+ workflowId : uuid4 ( ) ,
50+ taskQueue : 'test' ,
51+ args : [ 1_000_000 ] ,
52+ } )
53+ ) ;
54+ t . pass ( ) ;
55+ }
56+ ) ;
5457
55- test_ . serial ( 'TestEnvironment can toggle between normal and skipped time' , async ( t ) => {
58+ testTimeSkipping . serial ( 'TestEnvironment can toggle between normal and skipped time' , async ( t ) => {
5659 const { client, nativeConnection } = t . context . testEnv ;
5760
5861 const worker = await Worker . create ( {
@@ -78,7 +81,7 @@ test_.serial('TestEnvironment can toggle between normal and skipped time', async
7881 t . pass ( ) ;
7982} ) ;
8083
81- test_ . serial ( 'TestEnvironment sleep can be used to delay activity completion' , async ( t ) => {
84+ testTimeSkipping . serial ( 'TestEnvironment sleep can be used to delay activity completion' , async ( t ) => {
8285 const { client, nativeConnection, sleep } = t . context . testEnv ;
8386
8487 const worker = await Worker . create ( {
@@ -107,7 +110,7 @@ test_.serial('TestEnvironment sleep can be used to delay activity completion', a
107110 t . pass ( ) ;
108111} ) ;
109112
110- test_ . serial ( 'TestEnvironment sleep can be used to delay sending a signal' , async ( t ) => {
113+ testTimeSkipping . serial ( 'TestEnvironment sleep can be used to delay sending a signal' , async ( t ) => {
111114 const { client, nativeConnection, sleep } = t . context . testEnv ;
112115
113116 const worker = await Worker . create ( {
@@ -128,7 +131,7 @@ test_.serial('TestEnvironment sleep can be used to delay sending a signal', asyn
128131 t . pass ( ) ;
129132} ) ;
130133
131- test_ . serial ( 'Workflow code can run assertions' , async ( t ) => {
134+ testTimeSkipping . serial ( 'Workflow code can run assertions' , async ( t ) => {
132135 const { client, nativeConnection } = t . context . testEnv ;
133136
134137 const worker = await Worker . create ( {
@@ -150,7 +153,7 @@ test_.serial('Workflow code can run assertions', async (t) => {
150153 t . is ( err ?. cause ?. message , 'Expected values to be strictly equal:\n\n6 !== 7\n' ) ;
151154} ) ;
152155
153- test_ . serial ( 'ABNADONED child timer can be fast-forwarded' , async ( t ) => {
156+ testTimeSkipping . serial ( 'ABNADONED child timer can be fast-forwarded' , async ( t ) => {
154157 const { client, nativeConnection } = t . context . testEnv ;
155158
156159 const worker = await Worker . create ( {
0 commit comments