@temporalio/testing 1.10.3 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +31 -15
- package/lib/index.js +31 -15
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
- package/src/index.ts +31 -15
package/lib/index.d.ts
CHANGED
|
@@ -119,26 +119,36 @@ export declare class TestWorkflowEnvironment {
|
|
|
119
119
|
/**
|
|
120
120
|
* Start a time skipping workflow environment.
|
|
121
121
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
122
|
+
* This environment automatically skips to the next events in time when a workflow handle's `result` is awaited on
|
|
123
|
+
* (which includes {@link WorkflowClient.execute}). Before the result is awaited on, time can be manually skipped
|
|
124
|
+
* forward using {@link sleep}. The currently known time can be obtained via {@link currentTimeMs}.
|
|
125
125
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
126
|
+
* This environment will be powered by the Temporal Time Skipping Test Server (part of the [Java SDK](https://github.com/temporalio/sdk-java)).
|
|
127
|
+
* Note that the Time Skipping Test Server does not support full capabilities of the regular Temporal Server, and may
|
|
128
|
+
* occasionally present different behaviors. For general Workflow testing, it is generally preferable to use {@link createLocal}
|
|
129
|
+
* instead.
|
|
129
130
|
*
|
|
130
131
|
* Users can reuse this environment for testing multiple independent workflows, but not concurrently. Time skipping,
|
|
131
132
|
* which is automatically done when awaiting a workflow result and manually done on sleep, is global to the
|
|
132
|
-
* environment, not to the workflow under test.
|
|
133
|
+
* environment, not to the workflow under test. We highly recommend running tests serially when using a single
|
|
134
|
+
* environment or creating a separate environment per test.
|
|
133
135
|
*
|
|
134
|
-
*
|
|
135
|
-
* test.
|
|
136
|
+
* By default, the latest release of the Test Serveer will be downloaded and cached to a temporary directory
|
|
137
|
+
* (e.g. `$TMPDIR/temporal-test-server-sdk-typescript-*` or `%TEMP%/temporal-test-server-sdk-typescript-*.exe`). Note
|
|
138
|
+
* that existing cached binairies will be reused without validation that they are still up-to-date, until the SDK
|
|
139
|
+
* itself is updated. Alternatively, a specific version number of the Test Server may be provided, or the path to an
|
|
140
|
+
* existing Test Server binary may be supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
136
141
|
*
|
|
137
|
-
*
|
|
142
|
+
* Note that the Test Server implementation may be changed to another one in the future. Therefore, there is no
|
|
143
|
+
* guarantee that Test Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
144
|
+
* be supported in the future.
|
|
145
|
+
*
|
|
146
|
+
* IMPORTANT: At this time, the Time Skipping Test Server is not supported on ARM platforms. Execution on Apple
|
|
147
|
+
* silicon Macs will work if Rosetta 2 is installed.
|
|
138
148
|
*/
|
|
139
149
|
static createTimeSkipping(opts?: TimeSkippingTestWorkflowEnvironmentOptions): Promise<TestWorkflowEnvironment>;
|
|
140
150
|
/**
|
|
141
|
-
* Start a full Temporal server locally
|
|
151
|
+
* Start a full Temporal server locally.
|
|
142
152
|
*
|
|
143
153
|
* This environment is good for testing full server capabilities, but does not support time skipping like
|
|
144
154
|
* {@link createTimeSkipping} does. {@link supportsTimeSkipping} will always return `false` for this environment.
|
|
@@ -146,11 +156,17 @@ export declare class TestWorkflowEnvironment {
|
|
|
146
156
|
*
|
|
147
157
|
* This local environment will be powered by [Temporal CLI](https://github.com/temporalio/cli), which is a
|
|
148
158
|
* self-contained executable for Temporal. By default, Temporal's database will not be persisted to disk, and no UI
|
|
149
|
-
* will be
|
|
159
|
+
* will be launched.
|
|
160
|
+
*
|
|
161
|
+
* By default, the latest release of the CLI will be downloaded and cached to a temporary directory
|
|
162
|
+
* (e.g. `$TMPDIR/temporal-sdk-typescript-*` or `%TEMP%/temporal-sdk-typescript-*.exe`). Note that existing cached
|
|
163
|
+
* binairies will be reused without validation that they are still up-to-date, until the SDK itself is updated.
|
|
164
|
+
* Alternatively, a specific version number of the CLI may be provided, or the path to an existing CLI binary may be
|
|
165
|
+
* supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
150
166
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
167
|
+
* Note that the Dev Server implementation may be changed to another one in the future. Therefore, there is no
|
|
168
|
+
* guarantee that Dev Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
169
|
+
* be supported in the future.
|
|
154
170
|
*/
|
|
155
171
|
static createLocal(opts?: LocalTestWorkflowEnvironmentOptions): Promise<TestWorkflowEnvironment>;
|
|
156
172
|
/**
|
package/lib/index.js
CHANGED
|
@@ -167,22 +167,32 @@ class TestWorkflowEnvironment {
|
|
|
167
167
|
/**
|
|
168
168
|
* Start a time skipping workflow environment.
|
|
169
169
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
170
|
+
* This environment automatically skips to the next events in time when a workflow handle's `result` is awaited on
|
|
171
|
+
* (which includes {@link WorkflowClient.execute}). Before the result is awaited on, time can be manually skipped
|
|
172
|
+
* forward using {@link sleep}. The currently known time can be obtained via {@link currentTimeMs}.
|
|
173
173
|
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
174
|
+
* This environment will be powered by the Temporal Time Skipping Test Server (part of the [Java SDK](https://github.com/temporalio/sdk-java)).
|
|
175
|
+
* Note that the Time Skipping Test Server does not support full capabilities of the regular Temporal Server, and may
|
|
176
|
+
* occasionally present different behaviors. For general Workflow testing, it is generally preferable to use {@link createLocal}
|
|
177
|
+
* instead.
|
|
177
178
|
*
|
|
178
179
|
* Users can reuse this environment for testing multiple independent workflows, but not concurrently. Time skipping,
|
|
179
180
|
* which is automatically done when awaiting a workflow result and manually done on sleep, is global to the
|
|
180
|
-
* environment, not to the workflow under test.
|
|
181
|
+
* environment, not to the workflow under test. We highly recommend running tests serially when using a single
|
|
182
|
+
* environment or creating a separate environment per test.
|
|
181
183
|
*
|
|
182
|
-
*
|
|
183
|
-
* test.
|
|
184
|
+
* By default, the latest release of the Test Serveer will be downloaded and cached to a temporary directory
|
|
185
|
+
* (e.g. `$TMPDIR/temporal-test-server-sdk-typescript-*` or `%TEMP%/temporal-test-server-sdk-typescript-*.exe`). Note
|
|
186
|
+
* that existing cached binairies will be reused without validation that they are still up-to-date, until the SDK
|
|
187
|
+
* itself is updated. Alternatively, a specific version number of the Test Server may be provided, or the path to an
|
|
188
|
+
* existing Test Server binary may be supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
184
189
|
*
|
|
185
|
-
*
|
|
190
|
+
* Note that the Test Server implementation may be changed to another one in the future. Therefore, there is no
|
|
191
|
+
* guarantee that Test Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
192
|
+
* be supported in the future.
|
|
193
|
+
*
|
|
194
|
+
* IMPORTANT: At this time, the Time Skipping Test Server is not supported on ARM platforms. Execution on Apple
|
|
195
|
+
* silicon Macs will work if Rosetta 2 is installed.
|
|
186
196
|
*/
|
|
187
197
|
static async createTimeSkipping(opts) {
|
|
188
198
|
return await this.create({
|
|
@@ -192,7 +202,7 @@ class TestWorkflowEnvironment {
|
|
|
192
202
|
});
|
|
193
203
|
}
|
|
194
204
|
/**
|
|
195
|
-
* Start a full Temporal server locally
|
|
205
|
+
* Start a full Temporal server locally.
|
|
196
206
|
*
|
|
197
207
|
* This environment is good for testing full server capabilities, but does not support time skipping like
|
|
198
208
|
* {@link createTimeSkipping} does. {@link supportsTimeSkipping} will always return `false` for this environment.
|
|
@@ -200,11 +210,17 @@ class TestWorkflowEnvironment {
|
|
|
200
210
|
*
|
|
201
211
|
* This local environment will be powered by [Temporal CLI](https://github.com/temporalio/cli), which is a
|
|
202
212
|
* self-contained executable for Temporal. By default, Temporal's database will not be persisted to disk, and no UI
|
|
203
|
-
* will be
|
|
213
|
+
* will be launched.
|
|
214
|
+
*
|
|
215
|
+
* By default, the latest release of the CLI will be downloaded and cached to a temporary directory
|
|
216
|
+
* (e.g. `$TMPDIR/temporal-sdk-typescript-*` or `%TEMP%/temporal-sdk-typescript-*.exe`). Note that existing cached
|
|
217
|
+
* binairies will be reused without validation that they are still up-to-date, until the SDK itself is updated.
|
|
218
|
+
* Alternatively, a specific version number of the CLI may be provided, or the path to an existing CLI binary may be
|
|
219
|
+
* supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
204
220
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
221
|
+
* Note that the Dev Server implementation may be changed to another one in the future. Therefore, there is no
|
|
222
|
+
* guarantee that Dev Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
223
|
+
* be supported in the future.
|
|
208
224
|
*/
|
|
209
225
|
static async createLocal(opts) {
|
|
210
226
|
return await this.create({
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;AAEH,qCAAmC,CAAC,kDAAkD;AACtF,0DAA6B;AAC7B,8DAAiC;AAEjC,+CAO4B;AAC5B,+CAO4B;AAC5B,sDAAyE;AACzE,+CAA2G;AAC3G,0DAA6D;AAC7D,8DAA2D;AAC3D,yDAMiC;AACjC,wFAAsF;AACtF,6CAAuD;AAevD;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,uBAAc;IAI5D,YAAY,OAA0C;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACM,KAAK,CAAC,MAAM,CACnB,UAAkB,EAClB,KAA0B,EAC1B,IAAwC;QAExC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC;gBACH,OAAO,MAAM,KAAK,CAAC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,KAAK,CAAC,GAAG,CAAuD,EAAK,EAAE,GAAG,IAAO;QACtF,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAgC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAe,CAAC;IAC5G,CAAC;CACF;AA/BD,0DA+BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/testing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Temporal.io SDK Testing sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"author": "Temporal Technologies Inc. <sdk@temporal.io>",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@temporalio/activity": "1.
|
|
16
|
-
"@temporalio/client": "1.
|
|
17
|
-
"@temporalio/common": "1.
|
|
18
|
-
"@temporalio/core-bridge": "1.
|
|
19
|
-
"@temporalio/proto": "1.
|
|
20
|
-
"@temporalio/worker": "1.
|
|
21
|
-
"@temporalio/workflow": "1.
|
|
15
|
+
"@temporalio/activity": "1.11.1",
|
|
16
|
+
"@temporalio/client": "1.11.1",
|
|
17
|
+
"@temporalio/common": "1.11.1",
|
|
18
|
+
"@temporalio/core-bridge": "1.11.1",
|
|
19
|
+
"@temporalio/proto": "1.11.1",
|
|
20
|
+
"@temporalio/worker": "1.11.1",
|
|
21
|
+
"@temporalio/workflow": "1.11.1",
|
|
22
22
|
"abort-controller": "^3.0.0"
|
|
23
23
|
},
|
|
24
24
|
"bugs": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "c4163f8a2ae87fe84dd435d56f69e23c5eefeffb"
|
|
41
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -226,22 +226,32 @@ export class TestWorkflowEnvironment {
|
|
|
226
226
|
/**
|
|
227
227
|
* Start a time skipping workflow environment.
|
|
228
228
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
229
|
+
* This environment automatically skips to the next events in time when a workflow handle's `result` is awaited on
|
|
230
|
+
* (which includes {@link WorkflowClient.execute}). Before the result is awaited on, time can be manually skipped
|
|
231
|
+
* forward using {@link sleep}. The currently known time can be obtained via {@link currentTimeMs}.
|
|
232
232
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
233
|
+
* This environment will be powered by the Temporal Time Skipping Test Server (part of the [Java SDK](https://github.com/temporalio/sdk-java)).
|
|
234
|
+
* Note that the Time Skipping Test Server does not support full capabilities of the regular Temporal Server, and may
|
|
235
|
+
* occasionally present different behaviors. For general Workflow testing, it is generally preferable to use {@link createLocal}
|
|
236
|
+
* instead.
|
|
236
237
|
*
|
|
237
238
|
* Users can reuse this environment for testing multiple independent workflows, but not concurrently. Time skipping,
|
|
238
239
|
* which is automatically done when awaiting a workflow result and manually done on sleep, is global to the
|
|
239
|
-
* environment, not to the workflow under test.
|
|
240
|
+
* environment, not to the workflow under test. We highly recommend running tests serially when using a single
|
|
241
|
+
* environment or creating a separate environment per test.
|
|
240
242
|
*
|
|
241
|
-
*
|
|
242
|
-
* test.
|
|
243
|
+
* By default, the latest release of the Test Serveer will be downloaded and cached to a temporary directory
|
|
244
|
+
* (e.g. `$TMPDIR/temporal-test-server-sdk-typescript-*` or `%TEMP%/temporal-test-server-sdk-typescript-*.exe`). Note
|
|
245
|
+
* that existing cached binairies will be reused without validation that they are still up-to-date, until the SDK
|
|
246
|
+
* itself is updated. Alternatively, a specific version number of the Test Server may be provided, or the path to an
|
|
247
|
+
* existing Test Server binary may be supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
243
248
|
*
|
|
244
|
-
*
|
|
249
|
+
* Note that the Test Server implementation may be changed to another one in the future. Therefore, there is no
|
|
250
|
+
* guarantee that Test Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
251
|
+
* be supported in the future.
|
|
252
|
+
*
|
|
253
|
+
* IMPORTANT: At this time, the Time Skipping Test Server is not supported on ARM platforms. Execution on Apple
|
|
254
|
+
* silicon Macs will work if Rosetta 2 is installed.
|
|
245
255
|
*/
|
|
246
256
|
static async createTimeSkipping(opts?: TimeSkippingTestWorkflowEnvironmentOptions): Promise<TestWorkflowEnvironment> {
|
|
247
257
|
return await this.create({
|
|
@@ -252,7 +262,7 @@ export class TestWorkflowEnvironment {
|
|
|
252
262
|
}
|
|
253
263
|
|
|
254
264
|
/**
|
|
255
|
-
* Start a full Temporal server locally
|
|
265
|
+
* Start a full Temporal server locally.
|
|
256
266
|
*
|
|
257
267
|
* This environment is good for testing full server capabilities, but does not support time skipping like
|
|
258
268
|
* {@link createTimeSkipping} does. {@link supportsTimeSkipping} will always return `false` for this environment.
|
|
@@ -260,11 +270,17 @@ export class TestWorkflowEnvironment {
|
|
|
260
270
|
*
|
|
261
271
|
* This local environment will be powered by [Temporal CLI](https://github.com/temporalio/cli), which is a
|
|
262
272
|
* self-contained executable for Temporal. By default, Temporal's database will not be persisted to disk, and no UI
|
|
263
|
-
* will be
|
|
273
|
+
* will be launched.
|
|
274
|
+
*
|
|
275
|
+
* By default, the latest release of the CLI will be downloaded and cached to a temporary directory
|
|
276
|
+
* (e.g. `$TMPDIR/temporal-sdk-typescript-*` or `%TEMP%/temporal-sdk-typescript-*.exe`). Note that existing cached
|
|
277
|
+
* binairies will be reused without validation that they are still up-to-date, until the SDK itself is updated.
|
|
278
|
+
* Alternatively, a specific version number of the CLI may be provided, or the path to an existing CLI binary may be
|
|
279
|
+
* supplied; see {@link LocalTestWorkflowEnvironmentOptions.server.executable}.
|
|
264
280
|
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
281
|
+
* Note that the Dev Server implementation may be changed to another one in the future. Therefore, there is no
|
|
282
|
+
* guarantee that Dev Server options, and particularly those provided through the `extraArgs` array, will continue to
|
|
283
|
+
* be supported in the future.
|
|
268
284
|
*/
|
|
269
285
|
static async createLocal(opts?: LocalTestWorkflowEnvironmentOptions): Promise<TestWorkflowEnvironment> {
|
|
270
286
|
return await this.create({
|