@jsenv/test 3.0.21 → 3.0.23
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
|
@@ -3081,7 +3081,6 @@ const startMeasuringTotalCpuUsage = () => {
|
|
|
3081
3081
|
system: 0,
|
|
3082
3082
|
user: 0,
|
|
3083
3083
|
};
|
|
3084
|
-
|
|
3085
3084
|
const thisProcess = {
|
|
3086
3085
|
active: 0,
|
|
3087
3086
|
system: 0,
|
|
@@ -3101,7 +3100,7 @@ const startMeasuringTotalCpuUsage = () => {
|
|
|
3101
3100
|
let cpuArray = cpus();
|
|
3102
3101
|
const ms = Date.now();
|
|
3103
3102
|
const ellapsedMs = ms - previousMs;
|
|
3104
|
-
const
|
|
3103
|
+
const cpuUsageSampleArray = [];
|
|
3105
3104
|
let overallSystemMs = 0;
|
|
3106
3105
|
let overallUserMs = 0;
|
|
3107
3106
|
let overallInactiveMs = 0;
|
|
@@ -3121,7 +3120,7 @@ const startMeasuringTotalCpuUsage = () => {
|
|
|
3121
3120
|
system: systemMs / ellapsedMs,
|
|
3122
3121
|
user: userMs / ellapsedMs,
|
|
3123
3122
|
};
|
|
3124
|
-
|
|
3123
|
+
cpuUsageSampleArray.push(cpuUsageSample);
|
|
3125
3124
|
|
|
3126
3125
|
overallSystemMs += systemMs;
|
|
3127
3126
|
overallUserMs += userMs;
|
|
@@ -3138,10 +3137,6 @@ const startMeasuringTotalCpuUsage = () => {
|
|
|
3138
3137
|
};
|
|
3139
3138
|
previousCpuArray = cpuArray;
|
|
3140
3139
|
previousMs = ms;
|
|
3141
|
-
samples.push({
|
|
3142
|
-
cpuUsagesSample,
|
|
3143
|
-
overallUsageSample,
|
|
3144
|
-
});
|
|
3145
3140
|
|
|
3146
3141
|
const processCpuUsage = cpuUsage();
|
|
3147
3142
|
const thisProcessSystemMs = Math.round(
|
|
@@ -3151,53 +3146,83 @@ const startMeasuringTotalCpuUsage = () => {
|
|
|
3151
3146
|
(processCpuUsage.user - previousCpuUsage.user) / 1000,
|
|
3152
3147
|
);
|
|
3153
3148
|
previousCpuUsage = processCpuUsage;
|
|
3154
|
-
const thisProcessActiveMs = thisProcessSystemMs + thisProcessUserMs;
|
|
3155
|
-
thisProcess.active = thisProcessActiveMs / overallMsEllapsed;
|
|
3156
|
-
thisProcess.system = thisProcessSystemMs / overallMsEllapsed;
|
|
3157
|
-
thisProcess.user = thisProcessUserMs / overallMsEllapsed;
|
|
3158
3149
|
|
|
3150
|
+
const thisProcessActiveMs = thisProcessSystemMs + thisProcessUserMs;
|
|
3151
|
+
const thisProcessInactiveMs = overallMsEllapsed - thisProcessActiveMs;
|
|
3152
|
+
const thisProcessSample = {
|
|
3153
|
+
inactive: thisProcessInactiveMs / overallMsEllapsed,
|
|
3154
|
+
active: thisProcessActiveMs / overallMsEllapsed,
|
|
3155
|
+
system: thisProcessSystemMs / overallMsEllapsed,
|
|
3156
|
+
user: thisProcessUserMs / overallMsEllapsed,
|
|
3157
|
+
};
|
|
3158
|
+
samples.push({
|
|
3159
|
+
cpuUsageSampleArray,
|
|
3160
|
+
overallUsageSample,
|
|
3161
|
+
thisProcessSample,
|
|
3162
|
+
});
|
|
3159
3163
|
if (samples.length === 10) {
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3164
|
+
{
|
|
3165
|
+
let index = 0;
|
|
3166
|
+
for (const detail of details) {
|
|
3167
|
+
let systemSum = 0;
|
|
3168
|
+
let userSum = 0;
|
|
3169
|
+
let inactiveSum = 0;
|
|
3170
|
+
let activeSum = 0;
|
|
3171
|
+
for (const sample of samples) {
|
|
3172
|
+
const { cpuUsageSampleArray } = sample;
|
|
3173
|
+
const cpuUsageSample = cpuUsageSampleArray[index];
|
|
3174
|
+
inactiveSum += cpuUsageSample.inactive;
|
|
3175
|
+
activeSum += cpuUsageSample.active;
|
|
3176
|
+
systemSum += cpuUsageSample.system;
|
|
3177
|
+
userSum += cpuUsageSample.user;
|
|
3178
|
+
}
|
|
3179
|
+
Object.assign(detail, {
|
|
3180
|
+
inactive: inactiveSum / samples.length,
|
|
3181
|
+
active: activeSum / samples.length,
|
|
3182
|
+
system: systemSum / samples.length,
|
|
3183
|
+
user: userSum / samples.length,
|
|
3184
|
+
});
|
|
3185
|
+
index++;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
{
|
|
3189
|
+
let overallSystemSum = 0;
|
|
3190
|
+
let overallUserSum = 0;
|
|
3191
|
+
let overallInactiveSum = 0;
|
|
3192
|
+
let overallActiveSum = 0;
|
|
3166
3193
|
for (const sample of samples) {
|
|
3167
|
-
const {
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
userSum += cpuUsageSample.user;
|
|
3194
|
+
const { overallUsageSample } = sample;
|
|
3195
|
+
overallSystemSum += overallUsageSample.system;
|
|
3196
|
+
overallUserSum += overallUsageSample.user;
|
|
3197
|
+
overallInactiveSum += overallUsageSample.inactive;
|
|
3198
|
+
overallActiveSum += overallUsageSample.active;
|
|
3173
3199
|
}
|
|
3174
|
-
Object.assign(
|
|
3175
|
-
inactive:
|
|
3176
|
-
active:
|
|
3177
|
-
system:
|
|
3178
|
-
user:
|
|
3200
|
+
Object.assign(overall, {
|
|
3201
|
+
inactive: overallInactiveSum / samples.length,
|
|
3202
|
+
active: overallActiveSum / samples.length,
|
|
3203
|
+
system: overallSystemSum / samples.length,
|
|
3204
|
+
user: overallUserSum / samples.length,
|
|
3179
3205
|
});
|
|
3180
|
-
index++;
|
|
3181
3206
|
}
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3207
|
+
{
|
|
3208
|
+
let thisProcessSystemSum = 0;
|
|
3209
|
+
let thisProcessUserSum = 0;
|
|
3210
|
+
let thisProcessInactiveSum = 0;
|
|
3211
|
+
let thisProcessActiveSum = 0;
|
|
3212
|
+
for (const sample of samples) {
|
|
3213
|
+
const { thisProcessSample } = sample;
|
|
3214
|
+
thisProcessSystemSum += thisProcessSample.system;
|
|
3215
|
+
thisProcessUserSum += thisProcessSample.user;
|
|
3216
|
+
thisProcessInactiveSum += thisProcessSample.inactive;
|
|
3217
|
+
thisProcessActiveSum += thisProcessSample.active;
|
|
3218
|
+
}
|
|
3219
|
+
Object.assign(thisProcess, {
|
|
3220
|
+
inactive: thisProcessInactiveSum / samples.length,
|
|
3221
|
+
active: thisProcessActiveSum / samples.length,
|
|
3222
|
+
system: thisProcessSystemSum / samples.length,
|
|
3223
|
+
user: thisProcessUserSum / samples.length,
|
|
3224
|
+
});
|
|
3193
3225
|
}
|
|
3194
|
-
Object.assign(overall, {
|
|
3195
|
-
inactive: overallInactiveSum / samples.length,
|
|
3196
|
-
active: overallActiveSum / samples.length,
|
|
3197
|
-
system: overallSystemSum / samples.length,
|
|
3198
|
-
user: overallUserSum / samples.length,
|
|
3199
|
-
});
|
|
3200
|
-
// console.log(formatUsage(globalUsageInfo));
|
|
3201
3226
|
samples.length = 0;
|
|
3202
3227
|
}
|
|
3203
3228
|
}, 15);
|
|
@@ -5289,6 +5314,13 @@ const renderErrors = (execution, logOptions) => {
|
|
|
5289
5314
|
};
|
|
5290
5315
|
|
|
5291
5316
|
const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
5317
|
+
return `\n${renderBigSection({
|
|
5318
|
+
title: "execution end",
|
|
5319
|
+
content: renderOutroContent(testPlanResult, logOptions),
|
|
5320
|
+
})}\n`;
|
|
5321
|
+
};
|
|
5322
|
+
|
|
5323
|
+
const renderOutroContent = (testPlanResult, logOptions = {}) => {
|
|
5292
5324
|
const lines = [];
|
|
5293
5325
|
const { counters } = testPlanResult;
|
|
5294
5326
|
const { planified } = counters;
|
|
@@ -5348,11 +5380,7 @@ const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
|
5348
5380
|
});
|
|
5349
5381
|
lines.push(memoryUsageLine);
|
|
5350
5382
|
}
|
|
5351
|
-
|
|
5352
|
-
return `\n${renderBigSection({
|
|
5353
|
-
title: "execution end",
|
|
5354
|
-
content: lines.join("\n"),
|
|
5355
|
-
})}\n`;
|
|
5383
|
+
return lines.join("\n");
|
|
5356
5384
|
};
|
|
5357
5385
|
|
|
5358
5386
|
const humanizeTiming = (value) => {
|
|
@@ -6197,7 +6225,7 @@ To fix this warning:
|
|
|
6197
6225
|
},
|
|
6198
6226
|
afterAll: async () => {
|
|
6199
6227
|
const title = "Jsenv test results";
|
|
6200
|
-
const summaryText = stripAnsi(
|
|
6228
|
+
const summaryText = stripAnsi(renderOutroContent(testPlanResult));
|
|
6201
6229
|
if (testPlanResult.failed) {
|
|
6202
6230
|
await githubCheckRun.fail({
|
|
6203
6231
|
title,
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ import { generateCoverage } from "../coverage/generate_coverage.js";
|
|
|
32
32
|
import { assertAndNormalizeWebServer } from "./web_server_param.js";
|
|
33
33
|
import { githubAnnotationFromError } from "./github_annotation_from_error.js";
|
|
34
34
|
import { run } from "./run.js";
|
|
35
|
-
import { reporterList,
|
|
35
|
+
import { reporterList, renderOutroContent } from "./reporters/reporter_list.js";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Execute a list of files and log how it goes.
|
|
@@ -744,7 +744,7 @@ To fix this warning:
|
|
|
744
744
|
},
|
|
745
745
|
afterAll: async () => {
|
|
746
746
|
const title = "Jsenv test results";
|
|
747
|
-
const summaryText = stripAnsi(
|
|
747
|
+
const summaryText = stripAnsi(renderOutroContent(testPlanResult));
|
|
748
748
|
if (testPlanResult.failed) {
|
|
749
749
|
await githubCheckRun.fail({
|
|
750
750
|
title,
|
|
@@ -580,7 +580,14 @@ const renderErrors = (execution, logOptions) => {
|
|
|
580
580
|
});
|
|
581
581
|
};
|
|
582
582
|
|
|
583
|
-
|
|
583
|
+
const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
584
|
+
return `\n${renderBigSection({
|
|
585
|
+
title: "execution end",
|
|
586
|
+
content: renderOutroContent(testPlanResult, logOptions),
|
|
587
|
+
})}\n`;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
export const renderOutroContent = (testPlanResult, logOptions = {}) => {
|
|
584
591
|
const lines = [];
|
|
585
592
|
const { counters } = testPlanResult;
|
|
586
593
|
const { planified } = counters;
|
|
@@ -640,11 +647,7 @@ export const renderOutro = (testPlanResult, logOptions = {}) => {
|
|
|
640
647
|
});
|
|
641
648
|
lines.push(memoryUsageLine);
|
|
642
649
|
}
|
|
643
|
-
|
|
644
|
-
return `\n${renderBigSection({
|
|
645
|
-
title: "execution end",
|
|
646
|
-
content: lines.join("\n"),
|
|
647
|
-
})}\n`;
|
|
650
|
+
return lines.join("\n");
|
|
648
651
|
};
|
|
649
652
|
|
|
650
653
|
const humanizeTiming = (value) => {
|
package/src/helpers/cpu_usage.js
CHANGED
|
@@ -14,7 +14,6 @@ export const startMeasuringTotalCpuUsage = () => {
|
|
|
14
14
|
system: 0,
|
|
15
15
|
user: 0,
|
|
16
16
|
};
|
|
17
|
-
|
|
18
17
|
const thisProcess = {
|
|
19
18
|
active: 0,
|
|
20
19
|
system: 0,
|
|
@@ -34,7 +33,7 @@ export const startMeasuringTotalCpuUsage = () => {
|
|
|
34
33
|
let cpuArray = cpus();
|
|
35
34
|
const ms = Date.now();
|
|
36
35
|
const ellapsedMs = ms - previousMs;
|
|
37
|
-
const
|
|
36
|
+
const cpuUsageSampleArray = [];
|
|
38
37
|
let overallSystemMs = 0;
|
|
39
38
|
let overallUserMs = 0;
|
|
40
39
|
let overallInactiveMs = 0;
|
|
@@ -54,7 +53,7 @@ export const startMeasuringTotalCpuUsage = () => {
|
|
|
54
53
|
system: systemMs / ellapsedMs,
|
|
55
54
|
user: userMs / ellapsedMs,
|
|
56
55
|
};
|
|
57
|
-
|
|
56
|
+
cpuUsageSampleArray.push(cpuUsageSample);
|
|
58
57
|
|
|
59
58
|
overallSystemMs += systemMs;
|
|
60
59
|
overallUserMs += userMs;
|
|
@@ -71,10 +70,6 @@ export const startMeasuringTotalCpuUsage = () => {
|
|
|
71
70
|
};
|
|
72
71
|
previousCpuArray = cpuArray;
|
|
73
72
|
previousMs = ms;
|
|
74
|
-
samples.push({
|
|
75
|
-
cpuUsagesSample,
|
|
76
|
-
overallUsageSample,
|
|
77
|
-
});
|
|
78
73
|
|
|
79
74
|
const processCpuUsage = cpuUsage();
|
|
80
75
|
const thisProcessSystemMs = Math.round(
|
|
@@ -84,53 +79,83 @@ export const startMeasuringTotalCpuUsage = () => {
|
|
|
84
79
|
(processCpuUsage.user - previousCpuUsage.user) / 1000,
|
|
85
80
|
);
|
|
86
81
|
previousCpuUsage = processCpuUsage;
|
|
87
|
-
const thisProcessActiveMs = thisProcessSystemMs + thisProcessUserMs;
|
|
88
|
-
thisProcess.active = thisProcessActiveMs / overallMsEllapsed;
|
|
89
|
-
thisProcess.system = thisProcessSystemMs / overallMsEllapsed;
|
|
90
|
-
thisProcess.user = thisProcessUserMs / overallMsEllapsed;
|
|
91
82
|
|
|
83
|
+
const thisProcessActiveMs = thisProcessSystemMs + thisProcessUserMs;
|
|
84
|
+
const thisProcessInactiveMs = overallMsEllapsed - thisProcessActiveMs;
|
|
85
|
+
const thisProcessSample = {
|
|
86
|
+
inactive: thisProcessInactiveMs / overallMsEllapsed,
|
|
87
|
+
active: thisProcessActiveMs / overallMsEllapsed,
|
|
88
|
+
system: thisProcessSystemMs / overallMsEllapsed,
|
|
89
|
+
user: thisProcessUserMs / overallMsEllapsed,
|
|
90
|
+
};
|
|
91
|
+
samples.push({
|
|
92
|
+
cpuUsageSampleArray,
|
|
93
|
+
overallUsageSample,
|
|
94
|
+
thisProcessSample,
|
|
95
|
+
});
|
|
92
96
|
if (samples.length === 10) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
per_cpu: {
|
|
98
|
+
let index = 0;
|
|
99
|
+
for (const detail of details) {
|
|
100
|
+
let systemSum = 0;
|
|
101
|
+
let userSum = 0;
|
|
102
|
+
let inactiveSum = 0;
|
|
103
|
+
let activeSum = 0;
|
|
104
|
+
for (const sample of samples) {
|
|
105
|
+
const { cpuUsageSampleArray } = sample;
|
|
106
|
+
const cpuUsageSample = cpuUsageSampleArray[index];
|
|
107
|
+
inactiveSum += cpuUsageSample.inactive;
|
|
108
|
+
activeSum += cpuUsageSample.active;
|
|
109
|
+
systemSum += cpuUsageSample.system;
|
|
110
|
+
userSum += cpuUsageSample.user;
|
|
111
|
+
}
|
|
112
|
+
Object.assign(detail, {
|
|
113
|
+
inactive: inactiveSum / samples.length,
|
|
114
|
+
active: activeSum / samples.length,
|
|
115
|
+
system: systemSum / samples.length,
|
|
116
|
+
user: userSum / samples.length,
|
|
117
|
+
});
|
|
118
|
+
index++;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
all: {
|
|
122
|
+
let overallSystemSum = 0;
|
|
123
|
+
let overallUserSum = 0;
|
|
124
|
+
let overallInactiveSum = 0;
|
|
125
|
+
let overallActiveSum = 0;
|
|
99
126
|
for (const sample of samples) {
|
|
100
|
-
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
userSum += cpuUsageSample.user;
|
|
127
|
+
const { overallUsageSample } = sample;
|
|
128
|
+
overallSystemSum += overallUsageSample.system;
|
|
129
|
+
overallUserSum += overallUsageSample.user;
|
|
130
|
+
overallInactiveSum += overallUsageSample.inactive;
|
|
131
|
+
overallActiveSum += overallUsageSample.active;
|
|
106
132
|
}
|
|
107
|
-
Object.assign(
|
|
108
|
-
inactive:
|
|
109
|
-
active:
|
|
110
|
-
system:
|
|
111
|
-
user:
|
|
133
|
+
Object.assign(overall, {
|
|
134
|
+
inactive: overallInactiveSum / samples.length,
|
|
135
|
+
active: overallActiveSum / samples.length,
|
|
136
|
+
system: overallSystemSum / samples.length,
|
|
137
|
+
user: overallUserSum / samples.length,
|
|
112
138
|
});
|
|
113
|
-
index++;
|
|
114
139
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
140
|
+
this_process: {
|
|
141
|
+
let thisProcessSystemSum = 0;
|
|
142
|
+
let thisProcessUserSum = 0;
|
|
143
|
+
let thisProcessInactiveSum = 0;
|
|
144
|
+
let thisProcessActiveSum = 0;
|
|
145
|
+
for (const sample of samples) {
|
|
146
|
+
const { thisProcessSample } = sample;
|
|
147
|
+
thisProcessSystemSum += thisProcessSample.system;
|
|
148
|
+
thisProcessUserSum += thisProcessSample.user;
|
|
149
|
+
thisProcessInactiveSum += thisProcessSample.inactive;
|
|
150
|
+
thisProcessActiveSum += thisProcessSample.active;
|
|
151
|
+
}
|
|
152
|
+
Object.assign(thisProcess, {
|
|
153
|
+
inactive: thisProcessInactiveSum / samples.length,
|
|
154
|
+
active: thisProcessActiveSum / samples.length,
|
|
155
|
+
system: thisProcessSystemSum / samples.length,
|
|
156
|
+
user: thisProcessUserSum / samples.length,
|
|
157
|
+
});
|
|
126
158
|
}
|
|
127
|
-
Object.assign(overall, {
|
|
128
|
-
inactive: overallInactiveSum / samples.length,
|
|
129
|
-
active: overallActiveSum / samples.length,
|
|
130
|
-
system: overallSystemSum / samples.length,
|
|
131
|
-
user: overallUserSum / samples.length,
|
|
132
|
-
});
|
|
133
|
-
// console.log(formatUsage(globalUsageInfo));
|
|
134
159
|
samples.length = 0;
|
|
135
160
|
}
|
|
136
161
|
}, 15);
|
|
@@ -11,5 +11,7 @@ setInterval(() => {
|
|
|
11
11
|
|
|
12
12
|
const totalCpuUsage = startMeasuringTotalCpuUsage();
|
|
13
13
|
setInterval(() => {
|
|
14
|
-
console.log(formatUsage(totalCpuUsage.overall)
|
|
14
|
+
console.log(`overall: ${formatUsage(totalCpuUsage.overall)}
|
|
15
|
+
this process: ${formatUsage(totalCpuUsage.thisProcess)}
|
|
16
|
+
`);
|
|
15
17
|
}, 400);
|