Skip to content

Commit a0b4160

Browse files
committed
feat: report significant: false when t-test == true but sample size is too small.
This will help me sort out inconclusive tests without missing misconfigured ones. This is necessitated by the changes in the previous commit that allow for failure instead of forcing success.
1 parent d3f4f7b commit a0b4160

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/utils/analyze.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ function analyze(results, sorted = true, options = {}) {
6363
confidence: ttestResult.confidence,
6464
stars: ttestResult.stars,
6565
};
66+
} else {
67+
result.significanceTest = {
68+
significant: false
69+
}
6670
}
6771
}
6872
}

test/ttest.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ describe("T-Test Integration with analyze", () => {
272272
assert.ok(typeof testResult.significanceTest.confidence === "string");
273273
});
274274

275-
it("should not include significanceTest without sufficient samples", () => {
275+
it("should mark significanceTest as failed without samples", () => {
276276
const results = [
277277
{
278278
name: "baseline",
@@ -288,8 +288,7 @@ describe("T-Test Integration with analyze", () => {
288288
const analyzed = analyze(results, true, { ttest: true });
289289
const testResult = analyzed.find((r) => r.name === "test");
290290

291-
// Should not throw, and significanceTest should not be set (no samples)
292-
assert.strictEqual(testResult.significanceTest, undefined);
291+
assert.deepEqual(testResult.significanceTest, { significant: false});
293292
});
294293

295294
it("should not include significanceTest when samples < 30", () => {
@@ -310,8 +309,7 @@ describe("T-Test Integration with analyze", () => {
310309
const analyzed = analyze(results, true, { ttest: true });
311310
const testResult = analyzed.find((r) => r.name === "test");
312311

313-
// Should not throw, and significanceTest should not be set (not enough samples)
314-
assert.strictEqual(testResult.significanceTest, undefined);
312+
assert.deepEqual(testResult.significanceTest, { significant: false});
315313
});
316314

317315
it("should detect significant difference between clearly different benchmarks", () => {
@@ -424,6 +422,6 @@ describe("Statistical significance requires repeatSuite >= 30", () => {
424422
const analyzed = analyze(results, true, { ttest: true });
425423
const testResult = analyzed.find((r) => r.name === "test");
426424

427-
assert.strictEqual(testResult.significanceTest, undefined);
425+
assert.deepEqual(testResult.significanceTest, { significant: false});
428426
});
429427
});

0 commit comments

Comments
 (0)