@nsshunt/stsrunnerframework 1.0.72 → 1.0.74
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/dist/stsrunnerframework.mjs +80 -74
- package/dist/stsrunnerframework.mjs.map +1 -1
- package/dist/stsrunnerframework.umd.js +80 -74
- package/dist/stsrunnerframework.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/commonTypes.d.ts +1 -2
- package/types/commonTypes.d.ts.map +1 -1
- package/types/workerManager.d.ts +5 -1
- package/types/workerManager.d.ts.map +1 -1
|
@@ -13,7 +13,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
13
13
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
14
14
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
15
15
|
|
|
16
|
-
var _collectorCollectorPort, _runners, _options, _workerId, _debug, _error, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _processLoopExecutor2, _debug2,
|
|
16
|
+
var _collectorCollectorPort, _runners, _options, _workerId, _debug, _error, _processLoopExecutor, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options2, _STSInstrumentController, _telemetryProcessor, _archiveList, _processLoopExecutor2, _debug2, _SetRunnerIntoWorker, _ProcessTelemetry, _EmitEvent, _RunnerStateChange, _RemoveRunnerFromCollection, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2;
|
|
17
17
|
const URI_BASE_VUEUTILS = "/";
|
|
18
18
|
const STS_RF_RES_PREFIX = "STS_R_RF_";
|
|
19
19
|
const STS_RF_RES_ENT_PREFIX = "STS_RE_RF_";
|
|
@@ -2021,7 +2021,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2021
2021
|
chalk.level = 3;
|
|
2022
2022
|
class STSWorkerManager {
|
|
2023
2023
|
constructor(options) {
|
|
2024
|
-
__privateAdd(this, _STSWorkerManager_instances);
|
|
2025
2024
|
//#agentSession: string = null;
|
|
2026
2025
|
__privateAdd(this, _workersEx, {});
|
|
2027
2026
|
__privateAdd(this, _options2);
|
|
@@ -2054,16 +2053,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2054
2053
|
await runnerEx.publishInstrumentController.EndPublish();
|
|
2055
2054
|
await stsutils.Sleep(250);
|
|
2056
2055
|
}
|
|
2057
|
-
const runner =
|
|
2058
|
-
id: runnerEx.id,
|
|
2059
|
-
asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
|
|
2060
|
-
instrumentData: { ...runnerEx.instrumentData },
|
|
2061
|
-
iteration: runnerEx.iteration,
|
|
2062
|
-
options: { ...runnerEx.options },
|
|
2063
|
-
runnerHistory: [...runnerEx.runnerHistory],
|
|
2064
|
-
state: runnerEx.state,
|
|
2065
|
-
workerId: runnerEx.workerId
|
|
2066
|
-
};
|
|
2056
|
+
const runner = this.CreateRunnerCopy(runnerEx);
|
|
2067
2057
|
__privateGet(this, _archiveList).push(runner);
|
|
2068
2058
|
if (__privateGet(this, _archiveList).length > __privateGet(this, _options2).maxArchiveListLength) {
|
|
2069
2059
|
__privateGet(this, _archiveList).shift();
|
|
@@ -2102,7 +2092,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2102
2092
|
id: workerId,
|
|
2103
2093
|
worker: workerFactory.createWorkerThreadWorker(),
|
|
2104
2094
|
messagePort: port1,
|
|
2105
|
-
state: IWorkerState.starting,
|
|
2106
2095
|
workerThreadWorkerOptions: workerFactory.workerThreadWorkerOptions,
|
|
2107
2096
|
runnersEx: {},
|
|
2108
2097
|
runnersEvents: {},
|
|
@@ -2174,17 +2163,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2174
2163
|
const publishMessagePayload2 = data;
|
|
2175
2164
|
switch (publishMessagePayload2.command) {
|
|
2176
2165
|
case eIWMessageCommands.MessagePortResponse:
|
|
2177
|
-
|
|
2166
|
+
__privateGet(this, _debug2).call(this, `AddWorker:processMessage(): eIWMessageCommands.MessagePortResponse`);
|
|
2178
2167
|
break;
|
|
2179
2168
|
case eIWMessageCommands.InstrumentTelemetry:
|
|
2180
2169
|
__privateGet(this, _ProcessTelemetry).call(this, stsWorkerEx, publishMessagePayload2.payload);
|
|
2181
2170
|
break;
|
|
2182
|
-
/*
|
|
2183
|
-
case eIWMessageCommands.Completed :
|
|
2184
|
-
//this.#debug(`AddWorker::eIWMessageCommands.InstrumentTelemetry`);
|
|
2185
|
-
this.#ProcessCompleted(stsWorkerEx, publishMessagePayload.payload as ITestRunnerTelemetryPayload);
|
|
2186
|
-
break;
|
|
2187
|
-
*/
|
|
2188
2171
|
case eIWMessageCommands.RunnerStateChange:
|
|
2189
2172
|
__privateGet(this, _RunnerStateChange).call(this, stsWorkerEx, publishMessagePayload2.payload);
|
|
2190
2173
|
break;
|
|
@@ -2224,7 +2207,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2224
2207
|
});
|
|
2225
2208
|
__privateAdd(this, _SetRunnerIntoWorker, (workerEx, runnerEx) => {
|
|
2226
2209
|
const payload = {
|
|
2227
|
-
runner:
|
|
2210
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2228
2211
|
};
|
|
2229
2212
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.AddRunner, payload);
|
|
2230
2213
|
});
|
|
@@ -2262,6 +2245,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2262
2245
|
if (workerEx.runnersEx[runner.id]) {
|
|
2263
2246
|
const runnerEx = workerEx.runnersEx[runner.id];
|
|
2264
2247
|
runnerEx.state = runner.state;
|
|
2248
|
+
if (!runnerEx.runnerHistory) {
|
|
2249
|
+
runnerEx.runnerHistory = [];
|
|
2250
|
+
}
|
|
2265
2251
|
runnerEx.runnerHistory.push({
|
|
2266
2252
|
eventDate: /* @__PURE__ */ new Date(),
|
|
2267
2253
|
runner: { ...runner }
|
|
@@ -2361,61 +2347,59 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2361
2347
|
});
|
|
2362
2348
|
__privateAdd(this, _StartRunner2, async (workerEx, runnerEx) => {
|
|
2363
2349
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StartRunner, {
|
|
2364
|
-
runner:
|
|
2350
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2365
2351
|
});
|
|
2366
2352
|
return true;
|
|
2367
2353
|
});
|
|
2368
2354
|
__privateAdd(this, _ResetRunner2, async (workerEx, runnerEx) => {
|
|
2369
2355
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResetRunner, {
|
|
2370
|
-
runner:
|
|
2356
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2371
2357
|
});
|
|
2372
2358
|
return true;
|
|
2373
2359
|
});
|
|
2374
2360
|
__privateAdd(this, _ExecuteRunner2, async (workerEx, runnerEx) => {
|
|
2375
2361
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ExecuteRunner, {
|
|
2376
|
-
runner:
|
|
2362
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2377
2363
|
});
|
|
2378
2364
|
return true;
|
|
2379
2365
|
});
|
|
2380
2366
|
__privateAdd(this, _StopRunner2, async (workerEx, runnerEx) => {
|
|
2381
2367
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.StopRunner, {
|
|
2382
|
-
runner:
|
|
2368
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2383
2369
|
});
|
|
2384
2370
|
return true;
|
|
2385
2371
|
});
|
|
2386
2372
|
__privateAdd(this, _TerminateRunner2, async (workerEx, runnerEx) => {
|
|
2387
2373
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.TerminateRunner, {
|
|
2388
|
-
runner:
|
|
2374
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2389
2375
|
});
|
|
2390
2376
|
return true;
|
|
2391
2377
|
});
|
|
2392
2378
|
__privateAdd(this, _PauseRunner2, async (workerEx, runnerEx) => {
|
|
2393
2379
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.PauseRunner, {
|
|
2394
|
-
runner:
|
|
2380
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2395
2381
|
});
|
|
2396
2382
|
return true;
|
|
2397
2383
|
});
|
|
2398
2384
|
__privateAdd(this, _ResumeRunner2, async (workerEx, runnerEx) => {
|
|
2399
2385
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.ResumeRunner, {
|
|
2400
|
-
runner:
|
|
2386
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2401
2387
|
});
|
|
2402
2388
|
return true;
|
|
2403
2389
|
});
|
|
2404
2390
|
__privateAdd(this, _BroadcastCommandToAllRunners, async (workerEx, command, options) => {
|
|
2405
2391
|
try {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
await Promise.all(promArray);
|
|
2418
|
-
}
|
|
2392
|
+
const promArray = [];
|
|
2393
|
+
const ids = Object.keys(workerEx.runnersEx);
|
|
2394
|
+
ids.forEach((id) => {
|
|
2395
|
+
const runnerEx = workerEx.runnersEx[id];
|
|
2396
|
+
if (options) {
|
|
2397
|
+
promArray.push(command(workerEx, runnerEx, options));
|
|
2398
|
+
} else {
|
|
2399
|
+
promArray.push(command(workerEx, runnerEx));
|
|
2400
|
+
}
|
|
2401
|
+
});
|
|
2402
|
+
await Promise.all(promArray);
|
|
2419
2403
|
return true;
|
|
2420
2404
|
} catch (error) {
|
|
2421
2405
|
console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
@@ -2442,19 +2426,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2442
2426
|
});
|
|
2443
2427
|
__privateAdd(this, _BroadcastUpdateCommandToAllRunners, async (workerEx, command, executionProfile) => {
|
|
2444
2428
|
try {
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
await Promise.all(promArray);
|
|
2457
|
-
}
|
|
2429
|
+
const promArray = [];
|
|
2430
|
+
const ids = Object.keys(workerEx.runnersEx);
|
|
2431
|
+
ids.forEach((id) => {
|
|
2432
|
+
const runnerEx = workerEx.runnersEx[id];
|
|
2433
|
+
if (executionProfile) {
|
|
2434
|
+
promArray.push(command(workerEx, runnerEx, executionProfile));
|
|
2435
|
+
} else {
|
|
2436
|
+
promArray.push(command(workerEx, runnerEx));
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
await Promise.all(promArray);
|
|
2458
2440
|
return true;
|
|
2459
2441
|
} catch (error) {
|
|
2460
2442
|
console.log(`Error in STSTestWorker:WorkerCommand: [${error}]`);
|
|
@@ -2467,14 +2449,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2467
2449
|
});
|
|
2468
2450
|
__privateAdd(this, _TerminateWorker, async (workerEx) => {
|
|
2469
2451
|
try {
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
} else {
|
|
2477
|
-
}
|
|
2452
|
+
await __privateGet(this, _BroadcastCommandToAllRunners).call(this, workerEx, __privateGet(this, _TerminateRunner2));
|
|
2453
|
+
if (workerEx.worker) {
|
|
2454
|
+
workerEx.worker.terminate();
|
|
2455
|
+
__privateGet(this, _debug2).call(this, `Terminated worker: [${workerEx.id}]`);
|
|
2456
|
+
delete __privateGet(this, _workersEx)[workerEx.id];
|
|
2457
|
+
} else {
|
|
2478
2458
|
}
|
|
2479
2459
|
return true;
|
|
2480
2460
|
} catch (error) {
|
|
@@ -2485,7 +2465,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2485
2465
|
__privateAdd(this, _UpdateOptions2, async (workerEx, runnerEx, executionProfile) => {
|
|
2486
2466
|
runnerEx.options.executionProfile = { ...executionProfile };
|
|
2487
2467
|
__privateGet(this, _PostMessageToWorker).call(this, workerEx, eIWMessageCommands.UpdateOptions, {
|
|
2488
|
-
runner:
|
|
2468
|
+
runner: this.CreateRunnerCopyNoHistory(runnerEx)
|
|
2489
2469
|
});
|
|
2490
2470
|
return true;
|
|
2491
2471
|
});
|
|
@@ -2582,6 +2562,43 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2582
2562
|
}
|
|
2583
2563
|
__privateGet(this, _processLoopExecutor2).call(this);
|
|
2584
2564
|
}
|
|
2565
|
+
CreateRunnerCopyNoHistory(runnerEx) {
|
|
2566
|
+
return {
|
|
2567
|
+
id: runnerEx.id,
|
|
2568
|
+
asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
|
|
2569
|
+
instrumentData: { ...runnerEx.instrumentData },
|
|
2570
|
+
iteration: runnerEx.iteration,
|
|
2571
|
+
options: { ...runnerEx.options },
|
|
2572
|
+
state: runnerEx.state,
|
|
2573
|
+
workerId: runnerEx.workerId
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
CreateRunnerCopy(runnerEx) {
|
|
2577
|
+
const retVal = this.CreateRunnerCopyNoHistory(runnerEx);
|
|
2578
|
+
if (runnerEx.runnerHistory) {
|
|
2579
|
+
retVal.runnerHistory = [...runnerEx.runnerHistory];
|
|
2580
|
+
}
|
|
2581
|
+
return retVal;
|
|
2582
|
+
}
|
|
2583
|
+
CreateWorkerCopy(workerEx) {
|
|
2584
|
+
const { id, workerThreadWorkerOptions, runnersEx } = workerEx;
|
|
2585
|
+
const workerCopy = {
|
|
2586
|
+
id,
|
|
2587
|
+
workerThreadWorkerOptions: { ...workerThreadWorkerOptions },
|
|
2588
|
+
runners: {}
|
|
2589
|
+
};
|
|
2590
|
+
for (const [, runnerEx] of Object.entries(runnersEx)) {
|
|
2591
|
+
workerCopy.runners[runnerEx.id] = this.CreateRunnerCopy(runnerEx);
|
|
2592
|
+
}
|
|
2593
|
+
return workerCopy;
|
|
2594
|
+
}
|
|
2595
|
+
get Workers() {
|
|
2596
|
+
const retVal = {};
|
|
2597
|
+
for (const [, workerEx] of Object.entries(__privateGet(this, _workersEx))) {
|
|
2598
|
+
retVal[workerEx.id] = this.CreateWorkerCopy(workerEx);
|
|
2599
|
+
}
|
|
2600
|
+
return retVal;
|
|
2601
|
+
}
|
|
2585
2602
|
get WorkersEx() {
|
|
2586
2603
|
return __privateGet(this, _workersEx);
|
|
2587
2604
|
}
|
|
@@ -2602,17 +2619,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2602
2619
|
_archiveList = new WeakMap();
|
|
2603
2620
|
_processLoopExecutor2 = new WeakMap();
|
|
2604
2621
|
_debug2 = new WeakMap();
|
|
2605
|
-
_STSWorkerManager_instances = new WeakSet();
|
|
2606
|
-
CreateRunnerCopy_fn = function(runnerEx) {
|
|
2607
|
-
return {
|
|
2608
|
-
id: runnerEx.id,
|
|
2609
|
-
asyncRunnerContext: { ...runnerEx.asyncRunnerContext },
|
|
2610
|
-
options: { ...runnerEx.options },
|
|
2611
|
-
instrumentData: { ...runnerEx.instrumentData },
|
|
2612
|
-
iteration: runnerEx.iteration,
|
|
2613
|
-
state: runnerEx.state
|
|
2614
|
-
};
|
|
2615
|
-
};
|
|
2616
2622
|
_SetRunnerIntoWorker = new WeakMap();
|
|
2617
2623
|
_ProcessTelemetry = new WeakMap();
|
|
2618
2624
|
_EmitEvent = new WeakMap();
|