You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/vitest-plugin/src/walltime.ts
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,11 @@ export class WalltimeRunner extends NodeBenchmarkRunner {
98
98
resultasVitestTaskResult
99
99
);
100
100
101
+
if(stats===null){
102
+
console.log(` ✔ No walltime data to collect for ${uri}`);
103
+
returnnull;
104
+
}
105
+
101
106
constcoreBenchmark: Benchmark={
102
107
name: task.name,
103
108
uri,
@@ -121,7 +126,7 @@ export class WalltimeRunner extends NodeBenchmarkRunner {
121
126
122
127
privateconvertVitestResultToBenchmarkStats(
123
128
result: VitestTaskResult
124
-
): BenchmarkStats{
129
+
): BenchmarkStats|null{
125
130
constbenchmark=result.benchmark;
126
131
127
132
if(!benchmark){
@@ -138,6 +143,12 @@ export class WalltimeRunner extends NodeBenchmarkRunner {
138
143
constmeanNs=ms_to_ns(mean);
139
144
conststdevNs=ms_to_ns(sd);
140
145
146
+
if(sortedTimesNs.length==0){
147
+
// Sometimes the benchmarks can be completely optimized out and not even run, but its beforeEach and afterEach hooks are still executed, and the task is still considered a success.
148
+
// This is the case for the hooks.bench.ts example in this package
0 commit comments