@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.cjs CHANGED
@@ -5375,10 +5375,31 @@ var SuiteRunner = class {
5375
5375
  }
5376
5376
  this.stopped = true;
5377
5377
  }
5378
+ this.removeIdleListener();
5379
+ }
5380
+ /**
5381
+ * Remove the idle listener from the task queue, if one is registered.
5382
+ */
5383
+ removeIdleListener() {
5384
+ if (this.idleListener) {
5385
+ this.taskQueue.removeIdleListener(this.idleListener);
5386
+ this.idleListener = void 0;
5387
+ }
5378
5388
  }
5379
5389
  start(options) {
5380
5390
  var _a, _b, _c, _d, _e, _f, _g, _h;
5381
5391
  (_b = (_a = this.callbacks).onProgress) == null ? void 0 : _b.call(_a, 0);
5392
+ this.idleListener = (error) => {
5393
+ var _a2, _b2;
5394
+ if (error) {
5395
+ this.removeIdleListener();
5396
+ if (!this.stopped) {
5397
+ this.stopped = true;
5398
+ (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5399
+ }
5400
+ }
5401
+ };
5402
+ this.taskQueue.onIdle(this.idleListener);
5382
5403
  const modelSpecR = this.config.check.bundle.modelSpec;
5383
5404
  const dataPlanner = new DataPlanner(modelSpecR.outputVars.size);
5384
5405
  const refDataPlanner = new DataPlanner(modelSpecR.outputVars.size);
@@ -5417,25 +5438,22 @@ var SuiteRunner = class {
5417
5438
  });
5418
5439
  return;
5419
5440
  }
5420
- const buildReport = (error) => {
5421
- var _a2, _b2, _c2, _d2;
5422
- if (error) {
5423
- (_b2 = (_a2 = this.callbacks).onError) == null ? void 0 : _b2.call(_a2, error);
5424
- } else {
5425
- const checkReport = buildCheckReport2();
5426
- let comparisonReport;
5427
- if (this.config.comparison) {
5428
- comparisonReport = {
5429
- testReports: buildComparisonTestReports(),
5430
- perfReportL: this.perfStatsL.toReport(),
5431
- perfReportR: this.perfStatsR.toReport()
5432
- };
5433
- }
5434
- (_d2 = (_c2 = this.callbacks).onComplete) == null ? void 0 : _d2.call(_c2, {
5435
- checkReport,
5436
- comparisonReport
5437
- });
5441
+ const buildReport = () => {
5442
+ var _a2, _b2;
5443
+ this.removeIdleListener();
5444
+ const checkReport = buildCheckReport2();
5445
+ let comparisonReport;
5446
+ if (this.config.comparison) {
5447
+ comparisonReport = {
5448
+ testReports: buildComparisonTestReports(),
5449
+ perfReportL: this.perfStatsL.toReport(),
5450
+ perfReportR: this.perfStatsR.toReport()
5451
+ };
5438
5452
  }
5453
+ (_b2 = (_a2 = this.callbacks).onComplete) == null ? void 0 : _b2.call(_a2, {
5454
+ checkReport,
5455
+ comparisonReport
5456
+ });
5439
5457
  };
5440
5458
  let tasksCompleted = 0;
5441
5459
  let dataTaskId = 1;