@jsenv/test 3.3.7 → 3.3.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/jsenv_test.js
CHANGED
|
@@ -2285,7 +2285,6 @@ const collectFiles = async ({
|
|
|
2285
2285
|
associations,
|
|
2286
2286
|
});
|
|
2287
2287
|
if (!predicate(meta)) return;
|
|
2288
|
-
|
|
2289
2288
|
const relativeUrl = urlToRelativeUrl(
|
|
2290
2289
|
directoryChildNodeUrl,
|
|
2291
2290
|
rootDirectoryUrl,
|
|
@@ -4846,6 +4845,7 @@ const reporterList = ({
|
|
|
4846
4845
|
const log = renderExecutionLog(
|
|
4847
4846
|
execution,
|
|
4848
4847
|
logOptions,
|
|
4848
|
+
testPlanResult,
|
|
4849
4849
|
testPlanHelpers,
|
|
4850
4850
|
);
|
|
4851
4851
|
if (log) {
|
|
@@ -4869,6 +4869,7 @@ const reporterList = ({
|
|
|
4869
4869
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
4870
4870
|
let frameIndex = 0;
|
|
4871
4871
|
let oneExecutionWritten = false;
|
|
4872
|
+
const memoryHeapUsedAtStart = memoryUsage().heapUsed;
|
|
4872
4873
|
const renderDynamicLog = (testPlanResult) => {
|
|
4873
4874
|
frameIndex = frameIndex === frames.length - 1 ? 0 : frameIndex + 1;
|
|
4874
4875
|
let dynamicLogContent = "";
|
|
@@ -4888,12 +4889,18 @@ const reporterList = ({
|
|
|
4888
4889
|
rounded: false,
|
|
4889
4890
|
});
|
|
4890
4891
|
infos.push(ANSI.color(duration, ANSI.GREY));
|
|
4892
|
+
let memoryUsageColor = ANSI.GREY;
|
|
4891
4893
|
const memoryHeapUsed = memoryUsage().heapUsed;
|
|
4894
|
+
if (memoryHeapUsed > 1.5 * memoryHeapUsedAtStart) {
|
|
4895
|
+
memoryUsageColor = ANSI.YELLOW;
|
|
4896
|
+
} else if (memoryHeapUsed > 1.2 * memoryHeapUsedAtStart) {
|
|
4897
|
+
memoryUsageColor = null;
|
|
4898
|
+
}
|
|
4892
4899
|
const memoryHeapUsedFormatted = humanizeMemory(memoryHeapUsed, {
|
|
4893
4900
|
short: true,
|
|
4894
4901
|
decimals: 0,
|
|
4895
4902
|
});
|
|
4896
|
-
infos.push(ANSI.color(memoryHeapUsedFormatted,
|
|
4903
|
+
infos.push(ANSI.color(memoryHeapUsedFormatted, memoryUsageColor));
|
|
4897
4904
|
|
|
4898
4905
|
const infoFormatted = infos.join(ANSI.color(`/`, ANSI.GREY));
|
|
4899
4906
|
dynamicLogContent += ` ${ANSI.color(
|
|
@@ -4925,6 +4932,7 @@ const reporterList = ({
|
|
|
4925
4932
|
const log = renderExecutionLog(
|
|
4926
4933
|
execution,
|
|
4927
4934
|
logOptions,
|
|
4935
|
+
testPlanResult,
|
|
4928
4936
|
testPlanHelpers,
|
|
4929
4937
|
);
|
|
4930
4938
|
if (log) {
|
|
@@ -5056,6 +5064,7 @@ const renderIntro = (testPlanResult, logOptions) => {
|
|
|
5056
5064
|
const renderExecutionLog = (
|
|
5057
5065
|
execution,
|
|
5058
5066
|
logOptions,
|
|
5067
|
+
testPlanResult,
|
|
5059
5068
|
{ getPreviousExecution, getNextExecution },
|
|
5060
5069
|
) => {
|
|
5061
5070
|
if (execution.skipped) {
|
|
@@ -5131,16 +5140,28 @@ const renderExecutionLabel = (execution, logOptions) => {
|
|
|
5131
5140
|
const { timings, memoryUsage } = execution.result;
|
|
5132
5141
|
if (timings) {
|
|
5133
5142
|
const duration = timings.executionEnd - timings.executionStart;
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5143
|
+
if (logOptions.mockFluctuatingValues) {
|
|
5144
|
+
infos.push(ANSI.color(`<mock>ms`, ANSI.GREY));
|
|
5145
|
+
} else {
|
|
5146
|
+
let color = ANSI.GREY;
|
|
5147
|
+
if (duration > 0.8 * execution.params.allocatedMs) {
|
|
5148
|
+
color = ANSI.YELLOW;
|
|
5149
|
+
} else if (duration > 0.3 * execution.params.allocatedMs) {
|
|
5150
|
+
color = null;
|
|
5151
|
+
}
|
|
5152
|
+
infos.push(
|
|
5153
|
+
ANSI.color(humanizeDuration(duration, { short: true }), color),
|
|
5154
|
+
);
|
|
5155
|
+
}
|
|
5138
5156
|
}
|
|
5139
5157
|
if (logOptions.memoryUsage && typeof memoryUsage === "number") {
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5158
|
+
if (logOptions.mockFluctuatingValues) {
|
|
5159
|
+
infos.push(ANSI.color(`<mock>MB`, ANSI.GREY));
|
|
5160
|
+
} else {
|
|
5161
|
+
infos.push(
|
|
5162
|
+
ANSI.color(humanizeMemory(memoryUsage, { short: true }), ANSI.GREY),
|
|
5163
|
+
);
|
|
5164
|
+
}
|
|
5144
5165
|
}
|
|
5145
5166
|
if (infos.length) {
|
|
5146
5167
|
const runtimeInfo = infos.join(ANSI.color(`/`, ANSI.GREY));
|
|
@@ -5767,7 +5788,10 @@ const executeTestPlan = async ({
|
|
|
5767
5788
|
// (can eventually be used for debug)
|
|
5768
5789
|
keepRunning = false,
|
|
5769
5790
|
|
|
5770
|
-
githubCheck = process.
|
|
5791
|
+
githubCheck = process.argv.includes("--github-check") &&
|
|
5792
|
+
process.env.GITHUB_WORKFLOW
|
|
5793
|
+
? githubCheckDefault
|
|
5794
|
+
: null,
|
|
5771
5795
|
coverage = process.argv.includes("--coverage") ? coverageDefault : null,
|
|
5772
5796
|
|
|
5773
5797
|
reporters = [],
|
|
@@ -6093,13 +6117,16 @@ const executeTestPlan = async ({
|
|
|
6093
6117
|
}
|
|
6094
6118
|
testPlan = {
|
|
6095
6119
|
"file:///**/node_modules/": null,
|
|
6096
|
-
"**/*./": null,
|
|
6097
6120
|
...testPlan,
|
|
6121
|
+
"**/.*/": null,
|
|
6098
6122
|
"**/.jsenv/": null, // ensure it's impossible to look for ".jsenv/"
|
|
6099
6123
|
};
|
|
6100
6124
|
}
|
|
6101
6125
|
// webServer
|
|
6102
6126
|
if (runtimeInfo.someNeedsServer) {
|
|
6127
|
+
if (webServer.start) {
|
|
6128
|
+
webServer = await webServer.start();
|
|
6129
|
+
}
|
|
6103
6130
|
await assertAndNormalizeWebServer(webServer, {
|
|
6104
6131
|
signal: operation.signal,
|
|
6105
6132
|
teardownCallbackSet,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@c88/v8-coverage": "0.1.1",
|
|
40
40
|
"@jsenv/abort": "4.3.0",
|
|
41
|
-
"@jsenv/ast": "6.2.
|
|
42
|
-
"@jsenv/filesystem": "4.
|
|
43
|
-
"@jsenv/github-check-run": "0.1.
|
|
44
|
-
"@jsenv/humanize": "1.2.
|
|
45
|
-
"@jsenv/plugin-supervisor": "1.5.
|
|
46
|
-
"@jsenv/sourcemap": "1.2.
|
|
41
|
+
"@jsenv/ast": "6.2.2",
|
|
42
|
+
"@jsenv/filesystem": "4.8.0",
|
|
43
|
+
"@jsenv/github-check-run": "0.1.21",
|
|
44
|
+
"@jsenv/humanize": "1.2.4",
|
|
45
|
+
"@jsenv/plugin-supervisor": "1.5.2",
|
|
46
|
+
"@jsenv/sourcemap": "1.2.14",
|
|
47
47
|
"@jsenv/url-meta": "8.4.2",
|
|
48
|
-
"@jsenv/urls": "2.2.
|
|
48
|
+
"@jsenv/urls": "2.2.11",
|
|
49
49
|
"@jsenv/utils": "2.1.1",
|
|
50
50
|
"errorstacks": "2.4.1",
|
|
51
51
|
"he": "1.2.0",
|
|
@@ -129,7 +129,10 @@ export const executeTestPlan = async ({
|
|
|
129
129
|
// (can eventually be used for debug)
|
|
130
130
|
keepRunning = false,
|
|
131
131
|
|
|
132
|
-
githubCheck = process.
|
|
132
|
+
githubCheck = process.argv.includes("--github-check") &&
|
|
133
|
+
process.env.GITHUB_WORKFLOW
|
|
134
|
+
? githubCheckDefault
|
|
135
|
+
: null,
|
|
133
136
|
coverage = process.argv.includes("--coverage") ? coverageDefault : null,
|
|
134
137
|
|
|
135
138
|
reporters = [],
|
|
@@ -455,13 +458,16 @@ export const executeTestPlan = async ({
|
|
|
455
458
|
}
|
|
456
459
|
testPlan = {
|
|
457
460
|
"file:///**/node_modules/": null,
|
|
458
|
-
"**/*./": null,
|
|
459
461
|
...testPlan,
|
|
462
|
+
"**/.*/": null,
|
|
460
463
|
"**/.jsenv/": null, // ensure it's impossible to look for ".jsenv/"
|
|
461
464
|
};
|
|
462
465
|
}
|
|
463
466
|
// webServer
|
|
464
467
|
if (runtimeInfo.someNeedsServer) {
|
|
468
|
+
if (webServer.start) {
|
|
469
|
+
webServer = await webServer.start();
|
|
470
|
+
}
|
|
465
471
|
await assertAndNormalizeWebServer(webServer, {
|
|
466
472
|
signal: operation.signal,
|
|
467
473
|
teardownCallbackSet,
|
|
@@ -90,6 +90,7 @@ export const reporterList = ({
|
|
|
90
90
|
const log = renderExecutionLog(
|
|
91
91
|
execution,
|
|
92
92
|
logOptions,
|
|
93
|
+
testPlanResult,
|
|
93
94
|
testPlanHelpers,
|
|
94
95
|
);
|
|
95
96
|
if (log) {
|
|
@@ -113,6 +114,7 @@ export const reporterList = ({
|
|
|
113
114
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
114
115
|
let frameIndex = 0;
|
|
115
116
|
let oneExecutionWritten = false;
|
|
117
|
+
const memoryHeapUsedAtStart = processMemoryUsage().heapUsed;
|
|
116
118
|
const renderDynamicLog = (testPlanResult) => {
|
|
117
119
|
frameIndex = frameIndex === frames.length - 1 ? 0 : frameIndex + 1;
|
|
118
120
|
let dynamicLogContent = "";
|
|
@@ -132,12 +134,18 @@ export const reporterList = ({
|
|
|
132
134
|
rounded: false,
|
|
133
135
|
});
|
|
134
136
|
infos.push(ANSI.color(duration, ANSI.GREY));
|
|
137
|
+
let memoryUsageColor = ANSI.GREY;
|
|
135
138
|
const memoryHeapUsed = processMemoryUsage().heapUsed;
|
|
139
|
+
if (memoryHeapUsed > 1.5 * memoryHeapUsedAtStart) {
|
|
140
|
+
memoryUsageColor = ANSI.YELLOW;
|
|
141
|
+
} else if (memoryHeapUsed > 1.2 * memoryHeapUsedAtStart) {
|
|
142
|
+
memoryUsageColor = null;
|
|
143
|
+
}
|
|
136
144
|
const memoryHeapUsedFormatted = humanizeMemory(memoryHeapUsed, {
|
|
137
145
|
short: true,
|
|
138
146
|
decimals: 0,
|
|
139
147
|
});
|
|
140
|
-
infos.push(ANSI.color(memoryHeapUsedFormatted,
|
|
148
|
+
infos.push(ANSI.color(memoryHeapUsedFormatted, memoryUsageColor));
|
|
141
149
|
|
|
142
150
|
const infoFormatted = infos.join(ANSI.color(`/`, ANSI.GREY));
|
|
143
151
|
dynamicLogContent += ` ${ANSI.color(
|
|
@@ -169,6 +177,7 @@ export const reporterList = ({
|
|
|
169
177
|
const log = renderExecutionLog(
|
|
170
178
|
execution,
|
|
171
179
|
logOptions,
|
|
180
|
+
testPlanResult,
|
|
172
181
|
testPlanHelpers,
|
|
173
182
|
);
|
|
174
183
|
if (log) {
|
|
@@ -300,6 +309,7 @@ const renderIntro = (testPlanResult, logOptions) => {
|
|
|
300
309
|
const renderExecutionLog = (
|
|
301
310
|
execution,
|
|
302
311
|
logOptions,
|
|
312
|
+
testPlanResult,
|
|
303
313
|
{ getPreviousExecution, getNextExecution },
|
|
304
314
|
) => {
|
|
305
315
|
if (execution.skipped) {
|
|
@@ -330,7 +340,7 @@ const renderExecutionLog = (
|
|
|
330
340
|
let log = "";
|
|
331
341
|
// label
|
|
332
342
|
{
|
|
333
|
-
const label = renderExecutionLabel(execution, logOptions);
|
|
343
|
+
const label = renderExecutionLabel(execution, logOptions, testPlanResult);
|
|
334
344
|
log += label;
|
|
335
345
|
}
|
|
336
346
|
// console calls
|
|
@@ -375,16 +385,28 @@ const renderExecutionLabel = (execution, logOptions) => {
|
|
|
375
385
|
const { timings, memoryUsage } = execution.result;
|
|
376
386
|
if (timings) {
|
|
377
387
|
const duration = timings.executionEnd - timings.executionStart;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
388
|
+
if (logOptions.mockFluctuatingValues) {
|
|
389
|
+
infos.push(ANSI.color(`<mock>ms`, ANSI.GREY));
|
|
390
|
+
} else {
|
|
391
|
+
let color = ANSI.GREY;
|
|
392
|
+
if (duration > 0.8 * execution.params.allocatedMs) {
|
|
393
|
+
color = ANSI.YELLOW;
|
|
394
|
+
} else if (duration > 0.3 * execution.params.allocatedMs) {
|
|
395
|
+
color = null;
|
|
396
|
+
}
|
|
397
|
+
infos.push(
|
|
398
|
+
ANSI.color(humanizeDuration(duration, { short: true }), color),
|
|
399
|
+
);
|
|
400
|
+
}
|
|
382
401
|
}
|
|
383
402
|
if (logOptions.memoryUsage && typeof memoryUsage === "number") {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
403
|
+
if (logOptions.mockFluctuatingValues) {
|
|
404
|
+
infos.push(ANSI.color(`<mock>MB`, ANSI.GREY));
|
|
405
|
+
} else {
|
|
406
|
+
infos.push(
|
|
407
|
+
ANSI.color(humanizeMemory(memoryUsage, { short: true }), ANSI.GREY),
|
|
408
|
+
);
|
|
409
|
+
}
|
|
388
410
|
}
|
|
389
411
|
if (infos.length) {
|
|
390
412
|
const runtimeInfo = infos.join(ANSI.color(`/`, ANSI.GREY));
|