@jsenv/test 3.0.8 → 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}`,
@@ -6424,16 +6425,15 @@ To fix this warning:
6424
6425
  // if nothing is executing these limitations don't apply
6425
6426
  executionExecutingSet.size > 0
6426
6427
  ) {
6427
- const availableMemory = freemem();
6428
+ const freeMemory = freemem();
6428
6429
  const totalMemory = totalmem();
6429
- const usedMemory = totalMemory - availableMemory;
6430
+ const usedMemory = totalMemory - freeMemory;
6430
6431
  if (usedMemory > parallel.maxMemory) {
6431
6432
  // retry after Xms in case memory usage decreases
6432
6433
  const promise = operation.wait(200);
6433
6434
  promises.push(promise);
6434
6435
  break;
6435
6436
  }
6436
-
6437
6437
  if (cpuUsage.overall.active > parallel.maxCpu) {
6438
6438
  // retry after Xms in case cpu usage decreases
6439
6439
  const promise = operation.wait(200);
@@ -6450,7 +6450,10 @@ To fix this warning:
6450
6450
  break;
6451
6451
  }
6452
6452
  if (execution) {
6453
- const promise = start(execution);
6453
+ const promise = (async () => {
6454
+ await start(execution);
6455
+ await startAsMuchAsPossible();
6456
+ })();
6454
6457
  promises.push(promise);
6455
6458
  }
6456
6459
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.8",
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}`,
@@ -840,16 +841,15 @@ To fix this warning:
840
841
  // if nothing is executing these limitations don't apply
841
842
  executionExecutingSet.size > 0
842
843
  ) {
843
- const availableMemory = freemem();
844
+ const freeMemory = freemem();
844
845
  const totalMemory = totalmem();
845
- const usedMemory = totalMemory - availableMemory;
846
+ const usedMemory = totalMemory - freeMemory;
846
847
  if (usedMemory > parallel.maxMemory) {
847
848
  // retry after Xms in case memory usage decreases
848
849
  const promise = operation.wait(200);
849
850
  promises.push(promise);
850
851
  break;
851
852
  }
852
-
853
853
  if (cpuUsage.overall.active > parallel.maxCpu) {
854
854
  // retry after Xms in case cpu usage decreases
855
855
  const promise = operation.wait(200);
@@ -866,7 +866,10 @@ To fix this warning:
866
866
  break;
867
867
  }
868
868
  if (execution) {
869
- const promise = start(execution);
869
+ const promise = (async () => {
870
+ await start(execution);
871
+ await startAsMuchAsPossible();
872
+ })();
870
873
  promises.push(promise);
871
874
  }
872
875
  }