passsy / prefer-debuggable-coder3
Prefer Debuggable Code
PublicName intermediate values and declare them close to their use, so debuggers, logs and stack traces can show the state when code fails.
tests, run by the registry4 passed · slowest 4.1 ms
- The advice links to wellactually.dev
✓fires4.1 ms
points at the principle when the user mentions a breakpoint in a Dart project
prompt · in fixtures/dart_appfired: "breakpoint"
I can't set a breakpoint on that expression✓fires2.8 ms
points at the principle when the user asks for debuggable code
prompt · in fixtures/dart_appfired: "debuggable"
Make this more debuggable✓quiet2.6 ms
stays quiet on the same words outside a Dart project
promptstayed quiet
I can't set a breakpoint on that expression✓quiet4.1 ms
stays quiet on a prompt about something else
prompt · in fixtures/dart_appstayed quiet
Fix the layout breaks on tabletsdetector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { detect, prompt } from "@wellactually/sdk/v3/test";
const dartApp = { project: "fixtures/dart_app" };
test("points at the principle when the user mentions a breakpoint in a Dart project", () => {
expect(detect(prompt("I can't set a breakpoint on that expression"), dartApp)).toEqual([{ match: "breakpoint", depth: "pointer" }]);
});
test("points at the principle when the user asks for debuggable code", () => {
expect(detect(prompt("Make this more debuggable"), dartApp)).toEqual([{ match: "debuggable", depth: "pointer" }]);
});
test("stays quiet on the same words outside a Dart project", () => {
expect(detect(prompt("I can't set a breakpoint on that expression"))).toEqual([]);
});
test("stays quiet on a prompt about something else", () => {
expect(detect(prompt("Fix the layout breaks on tablets"), dartApp)).toEqual([]);
});