Spirolo

flake-candidate

A test that times itself or reads the date twice.

experimentalINSUFFICIENT

3 / 6 true, 95% Wilson interval 0.19 to 0.81, on 7 open-source projects.

Shown with --all. Gates only if you raise its severity.

What it reports

The test asserts on elapsed wall-clock time (a budget measured between two clock reads), or on a calendar value that both the code and the assertion read from the clock. The same code can fail on a slower or busier machine, or when a run crosses midnight.

Example

it('parses a large file quickly', () => {
  const start = Date.now();
  parse(largeFile);
  expect(Date.now() - start).toBeLessThan(50);
});

What to do

Freeze or set the clock (fake timers, a set system time), or assert the behaviour without timing it. A candidate is not an observed flake: flake-observed reports those.

Make it gate

It reports at info until you raise it:

// .spirolorc.jsonc
{ "rules": { "flake-candidate": "warn" } }

spirolo explain flake-candidate prints the same claim and status from your installed binary.

On this page