@jsenv/test 3.0.5 → 3.0.7
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/jsenv_test.js +2400 -2400
- package/package.json +4 -5
- package/src/coverage/report_coverage_as_json.js +2 -2
- package/src/coverage/v8_and_istanbul.js +1 -1
- package/src/coverage/v8_coverage_node_directory.js +1 -1
- package/src/execution/execute.js +1 -1
- package/src/execution/execute_test_plan.js +1 -1
- package/src/execution/format_error_for_terminal.js +2 -3
- package/src/execution/reporters/reporter_list.js +13 -8
- package/src/runtime_browsers/using_playwright.js +1 -1
- package/src/runtime_node/child_exec_options.js +1 -1
- package/src/runtime_node/node_child_process.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,10 +39,9 @@
|
|
|
39
39
|
"@c88/v8-coverage": "0.1.1",
|
|
40
40
|
"@jsenv/abort": "4.3.0",
|
|
41
41
|
"@jsenv/ast": "6.0.2",
|
|
42
|
-
"@jsenv/filesystem": "4.6.
|
|
43
|
-
"@jsenv/github-check-run": "0.1.
|
|
44
|
-
"@jsenv/
|
|
45
|
-
"@jsenv/log": "3.5.2",
|
|
42
|
+
"@jsenv/filesystem": "4.6.4",
|
|
43
|
+
"@jsenv/github-check-run": "0.1.9",
|
|
44
|
+
"@jsenv/humanize": "1.0.0",
|
|
46
45
|
"@jsenv/plugin-supervisor": "1.4.2",
|
|
47
46
|
"@jsenv/url-meta": "8.4.0",
|
|
48
47
|
"@jsenv/urls": "2.2.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { urlToFileSystemPath } from "@jsenv/urls";
|
|
2
2
|
import { writeFileSync } from "@jsenv/filesystem";
|
|
3
|
-
import {
|
|
3
|
+
import { humanizeFileSize } from "@jsenv/humanize";
|
|
4
4
|
|
|
5
5
|
export const reportCoverageAsJson = (
|
|
6
6
|
testPlanResult,
|
|
@@ -18,7 +18,7 @@ export const reportCoverageAsJson = (
|
|
|
18
18
|
writeFileSync(fileUrl, coverageAsText);
|
|
19
19
|
if (logs) {
|
|
20
20
|
console.log(
|
|
21
|
-
`-> ${urlToFileSystemPath(fileUrl)} (${
|
|
21
|
+
`-> ${urlToFileSystemPath(fileUrl)} (${humanizeFileSize(
|
|
22
22
|
Buffer.byteLength(coverageAsText),
|
|
23
23
|
)})`,
|
|
24
24
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, readdirSync } from "node:fs";
|
|
2
2
|
import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem";
|
|
3
|
-
import { createDetailedMessage } from "@jsenv/
|
|
3
|
+
import { createDetailedMessage } from "@jsenv/humanize";
|
|
4
4
|
import { Abort } from "@jsenv/abort";
|
|
5
5
|
|
|
6
6
|
export const readNodeV8CoverageDirectory = async ({
|
package/src/execution/execute.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort";
|
|
14
14
|
import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem";
|
|
15
|
-
import { createLogger } from "@jsenv/
|
|
15
|
+
import { createLogger } from "@jsenv/humanize";
|
|
16
16
|
|
|
17
17
|
import { assertAndNormalizeWebServer } from "./web_server_param.js";
|
|
18
18
|
import { run } from "./run.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
assertAndNormalizeDirectoryUrl,
|
|
14
14
|
collectFiles,
|
|
15
15
|
} from "@jsenv/filesystem";
|
|
16
|
-
import { createLogger, createDetailedMessage, UNICODE } from "@jsenv/
|
|
16
|
+
import { createLogger, createDetailedMessage, UNICODE } from "@jsenv/humanize";
|
|
17
17
|
import {
|
|
18
18
|
startGithubCheckRun,
|
|
19
19
|
readGitHubWorkflowEnv,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { generateContentFrame, ANSI } from "@jsenv/humanize";
|
|
3
3
|
import { urlToFileSystemPath } from "@jsenv/urls";
|
|
4
|
-
import { ANSI } from "@jsenv/log";
|
|
5
4
|
|
|
6
5
|
export const formatErrorForTerminal = (
|
|
7
6
|
error,
|
|
@@ -25,7 +24,7 @@ export const formatErrorForTerminal = (
|
|
|
25
24
|
typeof error.site.line === "number"
|
|
26
25
|
) {
|
|
27
26
|
const content = readFileSync(new URL(error.site.url), "utf8");
|
|
28
|
-
text +=
|
|
27
|
+
text += generateContentFrame({
|
|
29
28
|
content,
|
|
30
29
|
line: error.site.line,
|
|
31
30
|
column: error.site.column,
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { memoryUsage } from "node:process";
|
|
2
2
|
import stripAnsi from "strip-ansi";
|
|
3
3
|
import { writeFileSync } from "@jsenv/filesystem";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
createDynamicLog,
|
|
6
|
+
humanizeDuration,
|
|
7
|
+
humanizeMemoryUsage,
|
|
8
|
+
ANSI,
|
|
9
|
+
UNICODE,
|
|
10
|
+
} from "@jsenv/humanize";
|
|
6
11
|
|
|
7
12
|
import { formatErrorForTerminal } from "../format_error_for_terminal.js";
|
|
8
13
|
|
|
@@ -106,14 +111,14 @@ export const reporterList = ({
|
|
|
106
111
|
|
|
107
112
|
const msEllapsed = Date.now() - startMs;
|
|
108
113
|
const infos = [];
|
|
109
|
-
const duration =
|
|
114
|
+
const duration = humanizeDuration(msEllapsed, {
|
|
110
115
|
short: true,
|
|
111
116
|
decimals: 0,
|
|
112
117
|
rounded: false,
|
|
113
118
|
});
|
|
114
119
|
infos.push(ANSI.color(duration, ANSI.GREY));
|
|
115
120
|
const memoryHeapUsed = memoryUsage().heapUsed;
|
|
116
|
-
const memoryHeapUsedFormatted =
|
|
121
|
+
const memoryHeapUsedFormatted = humanizeMemoryUsage(memoryHeapUsed, {
|
|
117
122
|
short: true,
|
|
118
123
|
decimals: 0,
|
|
119
124
|
});
|
|
@@ -288,13 +293,13 @@ const renderExecutionLabel = (execution, logOptions) => {
|
|
|
288
293
|
const duration = timings.executionEnd - timings.executionStart;
|
|
289
294
|
const durationFormatted = logOptions.mockFluctuatingValues
|
|
290
295
|
? `<mock>ms`
|
|
291
|
-
:
|
|
296
|
+
: humanizeDuration(duration, { short: true });
|
|
292
297
|
infos.push(ANSI.color(durationFormatted, ANSI.GREY));
|
|
293
298
|
}
|
|
294
299
|
if (logOptions.showMemoryUsage && typeof memoryUsage === "number") {
|
|
295
300
|
const memoryUsageFormatted = logOptions.mockFluctuatingValues
|
|
296
301
|
? `<mock>MB`
|
|
297
|
-
:
|
|
302
|
+
: humanizeMemoryUsage(memoryUsage, { short: true });
|
|
298
303
|
infos.push(ANSI.color(memoryUsageFormatted, ANSI.GREY));
|
|
299
304
|
}
|
|
300
305
|
if (infos.length) {
|
|
@@ -572,7 +577,7 @@ export const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
|
572
577
|
if (logOptions.mockFluctuatingValues) {
|
|
573
578
|
durationLog += "<mock>s";
|
|
574
579
|
} else {
|
|
575
|
-
durationLog +=
|
|
580
|
+
durationLog += humanizeDuration(timings.end, { short: true });
|
|
576
581
|
const namedTimings = {
|
|
577
582
|
setup: timings.executionStart,
|
|
578
583
|
execution: timings.executionEnd,
|
|
@@ -584,7 +589,7 @@ export const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
|
584
589
|
const timingDetails = [];
|
|
585
590
|
for (const key of Object.keys(namedTimings)) {
|
|
586
591
|
const value = namedTimings[key];
|
|
587
|
-
const timingDuration =
|
|
592
|
+
const timingDuration = humanizeDuration(value, { short: true });
|
|
588
593
|
const timingString = `${ANSI.color(`${key}:`, ANSI.GREY)} ${ANSI.color(
|
|
589
594
|
timingDuration,
|
|
590
595
|
ANSI.GREY,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeFileSync, readFileSync } from "node:fs";
|
|
2
|
-
import { createDetailedMessage } from "@jsenv/
|
|
2
|
+
import { createDetailedMessage } from "@jsenv/humanize";
|
|
3
3
|
import { Abort, raceCallbacks } from "@jsenv/abort";
|
|
4
4
|
import { urlIsInsideOf } from "@jsenv/urls";
|
|
5
5
|
import { memoize } from "@jsenv/utils/src/memoize/memoize.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fork } from "node:child_process";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { Abort, raceCallbacks } from "@jsenv/abort";
|
|
4
|
-
import { createDetailedMessage } from "@jsenv/
|
|
4
|
+
import { createDetailedMessage } from "@jsenv/humanize";
|
|
5
5
|
import { memoize } from "@jsenv/utils/src/memoize/memoize.js";
|
|
6
6
|
|
|
7
7
|
import { createChildExecOptions } from "./child_exec_options.js";
|