@jsenv/test 3.0.7 → 3.0.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.
@@ -5671,8 +5671,8 @@ const coverageDefault = {
5671
5671
  };
5672
5672
  const parallelDefault = {
5673
5673
  max: "80%", // percentage resolved against the available cpus
5674
- maxCpu: "90%",
5675
- maxMemory: "90%",
5674
+ maxCpu: "100%",
5675
+ maxMemory: "100%",
5676
5676
  };
5677
5677
 
5678
5678
  const executeTestPlan = async ({
@@ -5886,7 +5886,8 @@ const executeTestPlan = async ({
5886
5886
  const maxMemory = parallel.maxMemory;
5887
5887
  if (typeof maxMemory === "string") {
5888
5888
  const maxMemoryAsRatio = assertPercentageAndConvertToRatio(maxMemory);
5889
- parallel.maxMemory = Math.round(maxMemoryAsRatio * totalmem());
5889
+ const totalMemory = totalmem();
5890
+ parallel.maxMemory = Math.round(maxMemoryAsRatio * totalMemory);
5890
5891
  } else if (typeof maxMemory !== "number") {
5891
5892
  throw new TypeError(
5892
5893
  `parallel.maxMemory must be a number or a percentage, got ${maxMemory}`,
@@ -6405,7 +6406,6 @@ To fix this warning:
6405
6406
  failFastAbortController.abort();
6406
6407
  return;
6407
6408
  }
6408
- await startAsMuchAsPossible();
6409
6409
  };
6410
6410
  const startAsMuchAsPossible = async () => {
6411
6411
  const promises = [];
@@ -6425,24 +6425,18 @@ To fix this warning:
6425
6425
  // if nothing is executing these limitations don't apply
6426
6426
  executionExecutingSet.size > 0
6427
6427
  ) {
6428
- const availableMemory = freemem();
6428
+ const freeMemory = freemem();
6429
6429
  const totalMemory = totalmem();
6430
- const usedMemory = totalMemory - availableMemory;
6430
+ const usedMemory = totalMemory - freeMemory;
6431
6431
  if (usedMemory > parallel.maxMemory) {
6432
6432
  // retry after Xms in case memory usage decreases
6433
- const promise = (async () => {
6434
- await operation.wait(200);
6435
- await startAsMuchAsPossible();
6436
- })();
6433
+ const promise = operation.wait(200);
6437
6434
  promises.push(promise);
6435
+ break;
6438
6436
  }
6439
-
6440
6437
  if (cpuUsage.overall.active > parallel.maxCpu) {
6441
6438
  // retry after Xms in case cpu usage decreases
6442
- const promise = (async () => {
6443
- await operation.wait(200);
6444
- await startAsMuchAsPossible();
6445
- })();
6439
+ const promise = operation.wait(200);
6446
6440
  promises.push(promise);
6447
6441
  break;
6448
6442
  }
@@ -6456,12 +6450,17 @@ To fix this warning:
6456
6450
  break;
6457
6451
  }
6458
6452
  if (execution) {
6459
- promises.push(start(execution));
6453
+ const promise = (async () => {
6454
+ await start(execution);
6455
+ await startAsMuchAsPossible();
6456
+ })();
6457
+ promises.push(promise);
6460
6458
  }
6461
6459
  }
6462
6460
  if (promises.length) {
6463
6461
  await Promise.all(promises);
6464
6462
  promises.length = 0;
6463
+ await startAsMuchAsPossible();
6465
6464
  }
6466
6465
  };
6467
6466
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -87,8 +87,8 @@ const coverageDefault = {
87
87
  };
88
88
  const parallelDefault = {
89
89
  max: "80%", // percentage resolved against the available cpus
90
- maxCpu: "90%",
91
- maxMemory: "90%",
90
+ maxCpu: "100%",
91
+ maxMemory: "100%",
92
92
  };
93
93
 
94
94
  export const executeTestPlan = async ({
@@ -302,7 +302,8 @@ export const executeTestPlan = async ({
302
302
  const maxMemory = parallel.maxMemory;
303
303
  if (typeof maxMemory === "string") {
304
304
  const maxMemoryAsRatio = assertPercentageAndConvertToRatio(maxMemory);
305
- parallel.maxMemory = Math.round(maxMemoryAsRatio * totalmem());
305
+ const totalMemory = totalmem();
306
+ parallel.maxMemory = Math.round(maxMemoryAsRatio * totalMemory);
306
307
  } else if (typeof maxMemory !== "number") {
307
308
  throw new TypeError(
308
309
  `parallel.maxMemory must be a number or a percentage, got ${maxMemory}`,
@@ -821,7 +822,6 @@ To fix this warning:
821
822
  failFastAbortController.abort();
822
823
  return;
823
824
  }
824
- await startAsMuchAsPossible();
825
825
  };
826
826
  const startAsMuchAsPossible = async () => {
827
827
  const promises = [];
@@ -841,24 +841,18 @@ To fix this warning:
841
841
  // if nothing is executing these limitations don't apply
842
842
  executionExecutingSet.size > 0
843
843
  ) {
844
- const availableMemory = freemem();
844
+ const freeMemory = freemem();
845
845
  const totalMemory = totalmem();
846
- const usedMemory = totalMemory - availableMemory;
846
+ const usedMemory = totalMemory - freeMemory;
847
847
  if (usedMemory > parallel.maxMemory) {
848
848
  // retry after Xms in case memory usage decreases
849
- const promise = (async () => {
850
- await operation.wait(200);
851
- await startAsMuchAsPossible();
852
- })();
849
+ const promise = operation.wait(200);
853
850
  promises.push(promise);
851
+ break;
854
852
  }
855
-
856
853
  if (cpuUsage.overall.active > parallel.maxCpu) {
857
854
  // retry after Xms in case cpu usage decreases
858
- const promise = (async () => {
859
- await operation.wait(200);
860
- await startAsMuchAsPossible();
861
- })();
855
+ const promise = operation.wait(200);
862
856
  promises.push(promise);
863
857
  break;
864
858
  }
@@ -872,12 +866,17 @@ To fix this warning:
872
866
  break;
873
867
  }
874
868
  if (execution) {
875
- promises.push(start(execution));
869
+ const promise = (async () => {
870
+ await start(execution);
871
+ await startAsMuchAsPossible();
872
+ })();
873
+ promises.push(promise);
876
874
  }
877
875
  }
878
876
  if (promises.length) {
879
877
  await Promise.all(promises);
880
878
  promises.length = 0;
879
+ await startAsMuchAsPossible();
881
880
  }
882
881
  };
883
882