@sdeverywhere/check-core 0.1.8 → 0.1.9

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/index.js CHANGED
@@ -5320,10 +5320,31 @@ var SuiteRunner = class {
5320
5320
  }
5321
5321
  this.stopped = true;
5322
5322
  }
5323
+ this.removeIdleListener();
5324
+ }
5325
+ /**
5326
+ * Remove the idle listener from the task queue, if one is registered.
5327
+ */
5328
+ removeIdleListener() {
5329
+ if (this.idleListener) {
5330
+ this.taskQueue.removeIdleListener(this.idleListener);
5331
+ this.idleListener = void 0;
5332
+ }
5323
5333
  }
5324
5334
  start(options) {
5325
5335
  var _a, _b, _c, _d, _e, _f, _g, _h;
5326
5336
  (_b = (_a = this.callbacks).onProgress) == null ? void 0 : _b.call(_a, 0);
5337
+ this.idleListener = (error) => {
5338
+ var _a2, _b2;
5339
+ if (error) {
5340
+ this.removeIdleListener();
5341
+ if (!this.stopped) {
5342
+ this.stopped = true;
5343
+ (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5344
+ }
5345
+ }
5346
+ };
5347
+ this.taskQueue.onIdle(this.idleListener);
5327
5348
  const modelSpecR = this.config.check.bundle.modelSpec;
5328
5349
  const dataPlanner = new DataPlanner(modelSpecR.outputVars.size);
5329
5350
  const refDataPlanner = new DataPlanner(modelSpecR.outputVars.size);
@@ -5362,25 +5383,22 @@ var SuiteRunner = class {
5362
5383
  });
5363
5384
  return;
5364
5385
  }
5365
- const buildReport = (error) => {
5366
- var _a2, _b2, _c2, _d2;
5367
- if (error) {
5368
- (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5369
- } else {
5370
- const checkReport = buildCheckReport2();
5371
- let comparisonReport;
5372
- if (this.config.comparison) {
5373
- comparisonReport = {
5374
- testReports: buildComparisonTestReports(),
5375
- perfReportL: this.perfStatsL.toReport(),
5376
- perfReportR: this.perfStatsR.toReport()
5377
- };
5378
- }
5379
- (_d2 = (_c2 = this.callbacks).onComplete) == null ? void 0 : _d2.call(_c2, {
5380
- checkReport,
5381
- comparisonReport
5382
- });
5386
+ const buildReport = () => {
5387
+ var _a2, _b2;
5388
+ this.removeIdleListener();
5389
+ const checkReport = buildCheckReport2();
5390
+ let comparisonReport;
5391
+ if (this.config.comparison) {
5392
+ comparisonReport = {
5393
+ testReports: buildComparisonTestReports(),
5394
+ perfReportL: this.perfStatsL.toReport(),
5395
+ perfReportR: this.perfStatsR.toReport()
5396
+ };
5383
5397
  }
5398
+ (_b2 = (_a2 = this.callbacks).onComplete) == null ? void 0 : _b2.call(_a2, {
5399
+ checkReport,
5400
+ comparisonReport
5401
+ });
5384
5402
  };
5385
5403
  let tasksCompleted = 0;
5386
5404
  let dataTaskId = 1;