@jsenv/test 3.0.4 → 3.0.5
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 +9 -3
- package/package.json +1 -1
- package/src/execution/run.js +9 -3
package/dist/jsenv_test.js
CHANGED
|
@@ -4553,8 +4553,8 @@ const run = async ({
|
|
|
4553
4553
|
}
|
|
4554
4554
|
|
|
4555
4555
|
const timingsOrigin = Date.now();
|
|
4556
|
-
const takeTiming = (
|
|
4557
|
-
return
|
|
4556
|
+
const takeTiming = () => {
|
|
4557
|
+
return Date.now() - timingsOrigin;
|
|
4558
4558
|
};
|
|
4559
4559
|
const result = {
|
|
4560
4560
|
status: "pending",
|
|
@@ -4646,7 +4646,7 @@ const run = async ({
|
|
|
4646
4646
|
onConsole: (log) => onConsoleRef.current(log),
|
|
4647
4647
|
onRuntimeStarted: () => {
|
|
4648
4648
|
runtimeStatus = "started";
|
|
4649
|
-
result.timings.runtimeStart =
|
|
4649
|
+
result.timings.runtimeStart = takeTiming();
|
|
4650
4650
|
},
|
|
4651
4651
|
onRuntimeStopped: () => {
|
|
4652
4652
|
if (runtimeStatus === "stopped") return; // ignore double calls
|
|
@@ -4688,6 +4688,12 @@ const run = async ({
|
|
|
4688
4688
|
const diff = timings.origin - result.timings.origin;
|
|
4689
4689
|
result.timings.executionStart = timings.start + diff;
|
|
4690
4690
|
result.timings.executionEnd = timings.end + diff;
|
|
4691
|
+
|
|
4692
|
+
if (result.timings.executionStart < result.timings.runtimeStart) {
|
|
4693
|
+
// can happen for browsers where navigationStart can be earlier
|
|
4694
|
+
// than when node.js calls runtimeStarted()
|
|
4695
|
+
result.timings.runtimeStart = result.timings.executionStart;
|
|
4696
|
+
}
|
|
4691
4697
|
}
|
|
4692
4698
|
result.memoryUsage =
|
|
4693
4699
|
typeof memoryUsage === "number"
|
package/package.json
CHANGED
package/src/execution/run.js
CHANGED
|
@@ -39,8 +39,8 @@ export const run = async ({
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const timingsOrigin = Date.now();
|
|
42
|
-
const takeTiming = (
|
|
43
|
-
return
|
|
42
|
+
const takeTiming = () => {
|
|
43
|
+
return Date.now() - timingsOrigin;
|
|
44
44
|
};
|
|
45
45
|
const result = {
|
|
46
46
|
status: "pending",
|
|
@@ -132,7 +132,7 @@ export const run = async ({
|
|
|
132
132
|
onConsole: (log) => onConsoleRef.current(log),
|
|
133
133
|
onRuntimeStarted: () => {
|
|
134
134
|
runtimeStatus = "started";
|
|
135
|
-
result.timings.runtimeStart =
|
|
135
|
+
result.timings.runtimeStart = takeTiming();
|
|
136
136
|
},
|
|
137
137
|
onRuntimeStopped: () => {
|
|
138
138
|
if (runtimeStatus === "stopped") return; // ignore double calls
|
|
@@ -174,6 +174,12 @@ export const run = async ({
|
|
|
174
174
|
const diff = timings.origin - result.timings.origin;
|
|
175
175
|
result.timings.executionStart = timings.start + diff;
|
|
176
176
|
result.timings.executionEnd = timings.end + diff;
|
|
177
|
+
|
|
178
|
+
if (result.timings.executionStart < result.timings.runtimeStart) {
|
|
179
|
+
// can happen for browsers where navigationStart can be earlier
|
|
180
|
+
// than when node.js calls runtimeStarted()
|
|
181
|
+
result.timings.runtimeStart = result.timings.executionStart;
|
|
182
|
+
}
|
|
177
183
|
}
|
|
178
184
|
result.memoryUsage =
|
|
179
185
|
typeof memoryUsage === "number"
|