@jsenv/test 3.4.4 → 3.5.1

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.
@@ -365,13 +365,19 @@ const applyAssociations = ({ url, associations }) => {
365
365
  };
366
366
 
367
367
  const deepAssign = (firstValue, secondValue) => {
368
- if (!isPlainObject(firstValue) || !isPlainObject(secondValue)) {
368
+ if (!isPlainObject(firstValue)) {
369
+ if (isPlainObject(secondValue)) {
370
+ return deepAssign({}, secondValue);
371
+ }
372
+ return secondValue;
373
+ }
374
+ if (!isPlainObject(secondValue)) {
369
375
  return secondValue;
370
376
  }
371
377
  for (const key of Object.keys(secondValue)) {
372
- const leftValue = firstValue[key];
373
- const rightValue = secondValue[key];
374
- firstValue[key] = deepAssign(leftValue, rightValue);
378
+ const leftPopertyValue = firstValue[key];
379
+ const rightPropertyValue = secondValue[key];
380
+ firstValue[key] = deepAssign(leftPopertyValue, rightPropertyValue);
375
381
  }
376
382
  return firstValue;
377
383
  };
@@ -8,6 +8,7 @@ import { readdir, chmod, stat, lstat, chmodSync, statSync, lstatSync, promises,
8
8
  import { dirname } from "node:path";
9
9
  import crypto from "node:crypto";
10
10
  import { readGitHubWorkflowEnv, startGithubCheckRun } from "@jsenv/github-check-run";
11
+ import { applyNodeEsmResolution } from "@jsenv/node-esm-resolution";
11
12
  import { takeCoverage } from "node:v8";
12
13
  import stripAnsi from "strip-ansi";
13
14
  import { createRequire } from "node:module";
@@ -4502,8 +4503,8 @@ const renderIntro = (testPlanResult, logOptions) => {
4502
4503
  if (!single) {
4503
4504
  testPlanLog += ",";
4504
4505
  }
4506
+ testPlanLog += "\n";
4505
4507
  }
4506
- testPlanLog += "\n";
4507
4508
  testPlanLog += "}";
4508
4509
  lines.push(`testPlan: ${testPlanLog}`);
4509
4510
  }
@@ -6328,10 +6329,30 @@ To fix this warning:
6328
6329
  // --- 100 execution found ---
6329
6330
  // Executing only from 33 to 66 according to fragment: "2/3"
6330
6331
 
6332
+ let onlyWithinUrl;
6333
+ if (process.argv.length > 2) {
6334
+ const onlyWithin = process.argv[2];
6335
+ if (onlyWithin[0] === "@") {
6336
+ const resolutionResult = applyNodeEsmResolution({
6337
+ specifier: onlyWithin,
6338
+ parentUrl: rootDirectoryUrl,
6339
+ });
6340
+ onlyWithinUrl = resolutionResult.packageDirectoryUrl;
6341
+ } else {
6342
+ onlyWithinUrl = new URL(onlyWithin, rootDirectoryUrl);
6343
+ }
6344
+ }
6345
+
6331
6346
  let index = 0;
6332
6347
  let lastExecution;
6333
6348
  const fileExecutionCountMap = new Map();
6334
6349
  for (const { relativeUrl, meta } of fileResultArray) {
6350
+ if (onlyWithinUrl) {
6351
+ const fileUrl = new URL(relativeUrl, rootDirectoryUrl).href;
6352
+ if (!urlIsInsideOf(fileUrl, onlyWithinUrl)) {
6353
+ continue;
6354
+ }
6355
+ }
6335
6356
  const filePlan = meta.testPlan;
6336
6357
  for (const groupName of Object.keys(filePlan)) {
6337
6358
  const stepConfig = filePlan[groupName];
@@ -6414,7 +6435,15 @@ To fix this warning:
6414
6435
  result: {},
6415
6436
  };
6416
6437
  if (typeof params.allocatedMs === "function") {
6417
- params.allocatedMs = params.allocatedMs(execution);
6438
+ const allocatedMsResult = params.allocatedMs(execution);
6439
+ params.allocatedMs =
6440
+ allocatedMsResult === undefined
6441
+ ? defaultMsAllocatedPerExecution
6442
+ : allocatedMsResult;
6443
+ }
6444
+ if (typeof params.uses === "function") {
6445
+ const usesResult = params.uses(execution);
6446
+ params.uses = usesResult;
6418
6447
  }
6419
6448
 
6420
6449
  lastExecution = execution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.4.4",
3
+ "version": "3.5.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,6 @@
28
28
  "/src/"
29
29
  ],
30
30
  "scripts": {
31
- "test": "node --conditions=development ./scripts/test.mjs",
32
31
  "build": "node --conditions=development ./scripts/build.mjs",
33
32
  "prepublishOnly": "npm run build"
34
33
  },
@@ -39,13 +38,14 @@
39
38
  "@c88/v8-coverage": "0.1.1",
40
39
  "@jsenv/abort": "4.3.0",
41
40
  "@jsenv/ast": "6.2.17",
42
- "@jsenv/exception": "1.1.2",
43
- "@jsenv/filesystem": "4.10.2",
44
- "@jsenv/github-check-run": "0.2.0",
41
+ "@jsenv/exception": "1.1.3",
42
+ "@jsenv/filesystem": "4.10.3",
43
+ "@jsenv/github-check-run": "0.2.1",
44
+ "@jsenv/node-esm-resolution": "1.0.6",
45
45
  "@jsenv/humanize": "1.2.8",
46
46
  "@jsenv/plugin-supervisor": "1.5.19",
47
47
  "@jsenv/sourcemap": "1.2.23",
48
- "@jsenv/url-meta": "8.5.1",
48
+ "@jsenv/url-meta": "8.5.2",
49
49
  "@jsenv/urls": "2.5.2",
50
50
  "@jsenv/utils": "2.1.2",
51
51
  "he": "1.2.0",
@@ -57,8 +57,5 @@
57
57
  "strip-ansi": "7.1.0",
58
58
  "supports-color": "9.4.0",
59
59
  "v8-to-istanbul": "9.3.0"
60
- },
61
- "devDependencies": {
62
- "@jsenv/terminal-recorder": "../independent/terminal-recorder/"
63
60
  }
64
61
  }
@@ -13,7 +13,9 @@ import {
13
13
  startGithubCheckRun,
14
14
  } from "@jsenv/github-check-run";
15
15
  import { createDetailedMessage, createLogger, UNICODE } from "@jsenv/humanize";
16
+ import { applyNodeEsmResolution } from "@jsenv/node-esm-resolution";
16
17
  import { URL_META } from "@jsenv/url-meta";
18
+ import { urlIsInsideOf } from "@jsenv/urls";
17
19
  import { existsSync } from "node:fs";
18
20
  import {
19
21
  availableParallelism,
@@ -661,10 +663,30 @@ To fix this warning:
661
663
  // --- 100 execution found ---
662
664
  // Executing only from 33 to 66 according to fragment: "2/3"
663
665
 
666
+ let onlyWithinUrl;
667
+ if (process.argv.length > 2) {
668
+ const onlyWithin = process.argv[2];
669
+ if (onlyWithin[0] === "@") {
670
+ const resolutionResult = applyNodeEsmResolution({
671
+ specifier: onlyWithin,
672
+ parentUrl: rootDirectoryUrl,
673
+ });
674
+ onlyWithinUrl = resolutionResult.packageDirectoryUrl;
675
+ } else {
676
+ onlyWithinUrl = new URL(onlyWithin, rootDirectoryUrl);
677
+ }
678
+ }
679
+
664
680
  let index = 0;
665
681
  let lastExecution;
666
682
  const fileExecutionCountMap = new Map();
667
683
  for (const { relativeUrl, meta } of fileResultArray) {
684
+ if (onlyWithinUrl) {
685
+ const fileUrl = new URL(relativeUrl, rootDirectoryUrl).href;
686
+ if (!urlIsInsideOf(fileUrl, onlyWithinUrl)) {
687
+ continue;
688
+ }
689
+ }
668
690
  const filePlan = meta.testPlan;
669
691
  for (const groupName of Object.keys(filePlan)) {
670
692
  const stepConfig = filePlan[groupName];
@@ -747,7 +769,15 @@ To fix this warning:
747
769
  result: {},
748
770
  };
749
771
  if (typeof params.allocatedMs === "function") {
750
- params.allocatedMs = params.allocatedMs(execution);
772
+ const allocatedMsResult = params.allocatedMs(execution);
773
+ params.allocatedMs =
774
+ allocatedMsResult === undefined
775
+ ? defaultMsAllocatedPerExecution
776
+ : allocatedMsResult;
777
+ }
778
+ if (typeof params.uses === "function") {
779
+ const usesResult = params.uses(execution);
780
+ params.uses = usesResult;
751
781
  }
752
782
 
753
783
  lastExecution = execution;
@@ -260,8 +260,8 @@ const renderIntro = (testPlanResult, logOptions) => {
260
260
  if (!single) {
261
261
  testPlanLog += ",";
262
262
  }
263
+ testPlanLog += "\n";
263
264
  }
264
- testPlanLog += "\n";
265
265
  testPlanLog += "}";
266
266
  lines.push(`testPlan: ${testPlanLog}`);
267
267
  }