github arktypeio/arktype @ark/attest@0.59.0

34 minutes ago
  • Fixed CLI trace and assertion edge cases (including Windows path handling, non-TTY stdout guards in ProgressDisplay, and empty/prose JSDoc strings in formatTypeString) and exported AttestFn / Bench / BenchFn types (#1777, #1782).

Runtime benches now run in a loop compiled for each bench, after a warmup of 500ms (or until.ms if shorter), with as many calls per sample as fit in about 0.2ms. Their times don't compare with earlier versions', so re-record stored runtime baselines.

  • Return the result a bench computes, so V8 can't drop its work as unused. attest warns when a bench returns undefined.
  • until.count and until.ms bound the samples taken after the warmup. They counted sets of 1000 calls and time from the bench's start.
  • A bench that returns a Promise is awaited whether or not it is an async function.
  • Sample times are sorted numerically. They were sorted as strings, which misordered times like 9.5 and 10.2 and skewed .median.
  • Instantiation counts include evaluating the type a bench (or a test with attest.instantiations) returns as fully as displaying it would. TypeScript defers members of types like mapped types until something reads them, so a result that was never used went partly uncounted. Benches whose results were already fully evaluated measure the same; re-record the rest.
  • benchErrorOnThresholdExceeded: "types" fails a .types() bench that exceeds its baseline, and "runtime" no longer does. Only attest.instantiations counted as a type bench, so .types() regressions were reported without failing.
  • An option set with its own ATTEST_ environment variable overrides the config setup() passes to child processes on every platform. On Windows, which sorts the environment, the inherited config overwrote it.
  • A failing .equals or .is prints values that aren't plain data, like a Type or an object holding one, with printable. Types and schema nodes print as their expressions, and other class instances inside a plain object or array print as their constructor's name. node:assert's diff walked their entire graphs and could run out of memory instead of failing (#1287). Plain data, including Maps, Sets, Dates and RegExps of it, keeps node:assert's diff.
  • .snap.toFile creates its snapshot file if it doesn't exist. It threw ENOENT unless the file was already there.
  • .completions() under TypeScript 7 includes completions of strings containing punctuation, like a JSON Schema $ref path. TypeScript 7 gives each a filter text of only its last word, which didn't match the prefix, so they were dropped and .completions() returned {}.
  • getChecker() returns the checker attest analyzes with, so a test can branch on output that differs between them.
  • attest trace and attest stats check projects with composite: true. They passed tsc --incremental false, which such a project rejects (TS6379), so since TypeScript 5.6 they skipped type checking and reported 0 instantiations (#1306).
  • @arktype/attest, which published the same package, is no longer published. Install @ark/attest.
  • arktype is a peer dependency at the version released with @ark/attest, where it was a dependency, so install the two together.

Full changelog: https://github.com/arktypeio/arktype/blob/@ark/attest@0.59.0/ark/attest/CHANGELOG.md

Don't miss a new arktype release

NewReleases is sending notifications on new releases.