test: cleaned test suites and documented filtering guidelines

- Remove redundant definedness, null, and type checks across test suites in multiple packages.
- Clean up unused assertions, metadata tests, and obsolete test cases.
- Add good versus bad test filter guidelines and requirements to project documentation.
This commit is contained in:
can1357
2026-08-13 08:26:19 +02:00
parent 04a0b44d6a
commit 6b4823181b
57 changed files with 73 additions and 704 deletions
@@ -112,27 +112,6 @@ describe("executeBash", () => {
expect(buildMinimizerOptions(group)).toBeUndefined();
});
it("forwards source outline and legacy filter settings to native minimizer options", () => {
const group: ShellMinimizerSettings = {
enabled: true,
settingsPath: "minimizer.toml",
only: ["git"],
except: ["docker"],
maxCaptureBytes: 1234,
sourceOutlineLevel: "aggressive",
legacyFilters: true,
};
expect(buildMinimizerOptions(group)).toEqual({
enabled: true,
settingsPath: "minimizer.toml",
only: ["git"],
except: ["docker"],
maxCaptureBytes: 1234,
sourceOutlineLevel: "aggressive",
legacyFilters: true,
});
});
it.each([
["cd", true],
[" cd child ", true],
@@ -753,7 +732,6 @@ exit 64
expect(result.cancelled).toBe(true);
expect(result.output).toContain("streamed-before-timeout");
expect(result.output).toContain("Command timed out after 1 seconds");
expect(nativeSignal).toBeDefined();
expect(nativeSignal?.aborted).toBe(false);
expect(abortSpy).toHaveBeenCalledTimes(1);
});
@@ -925,12 +903,10 @@ exit 64
cwd: tempDir,
timeout: 5000,
onChunk: chunk => {
expect(chunk.length).toBeGreaterThan(0);
chunks.push(chunk);
},
});
// At least one chunk should have been delivered to onChunk
expect(chunks.length).toBeGreaterThan(0);
const combined = chunks.join("");
expect(combined).toContain("line1");
// Final result always has the complete output regardless of chunk throttle
@@ -1062,7 +1038,6 @@ exit 64
PATH: Bun.env.PATH ?? "",
HOME: tempDir,
});
expect(snapshotPath).not.toBeNull();
const snapshot = fs.readFileSync(snapshotPath!, "utf8");
expect(snapshot).toContain("pi_snapshot_large_function");
expect(snapshot).not.toContain("base64 -d");
@@ -1267,7 +1242,6 @@ exit 64
expect(result.cancelled).toBe(true);
expect(result.output).toContain("flushed-during-timeout");
expect(result.output).toContain("Command timed out after 1 seconds");
expect(nativeSignal).toBeDefined();
expect(nativeSignal?.aborted).toBe(false);
expect(abortSpy).not.toHaveBeenCalled();
});