Skip to content

Upgrading ava 5 to 6

Breaking5.3.1 → 6.4.1Breaking9Platform3New9Changed9Fixed7Other4

BreakingUpgrade verdict

8 breaking changes and 3 platform requirement changes.

  • `.only()` no longer persists across runs the way it used to.
  • You can no longer turn on watch mode from your config files.
  • If a module you load via require exports a default function, AVA now calls it, and local TypeScript files are supported.
  • If your test file does not exit on its own, the test run will time out instead of being force-closed.
Top 5 of 11 that need code or config changes

Node.js requirement changed in 6.4.0: >=14.19 <15 || >=16.15 <17 || >=18 → ^18.18 || ^20.8 || ^22 || ^23 || >=24.

Adds @vercel/nft ^0.29.4, memoize ^10.1.0, package-config ^5.0.0.

Drops chokidar, clean-yaml-object, is-error, mem, p-event, pkg-conf.

Installs 177 packages in all (was 141).

Also installs @isaacs/cliui, @isaacs/fs-minipass, @mapbox/node-pre-gyp, @pkgjs/parseargs, @rollup/pluginutils, @sindresorhus/merge-streams, @types/estree, abbrev, acorn-import-attributes, agent-base, async-sema, balanced-match, bindings, brace-expansion, chownr and 33 more.

No longer installs aggregate-error, anymatch, binary-extensions, clean-stack, dir-glob, find-up, fsevents, is-binary-path, locate-path, map-age-cleaner, mimic-fn, normalize-path, p-defer, p-limit, p-locate and 4 more.

Moves cbor 8.1.0 → 10.0.12, ci-info 3.9.0 → 4.4.0, cli-truncate 3.1.0 → 4.0.0, emoji-regex 8.0.0, 9.2.2 → 10.6.0, 8.0.0, 9.2.2, figures 5.0.0 → 6.1.0, globby 13.2.2 → 14.1.0, ignore 5.3.2 → 7.0.14, is-unicode-supported 1.3.0 → 2.1.0, p-map 5.5.0 → 7.1.1, parse-ms 3.0.0 → 4.0.0, path-type 4.0.0 → 6.0.0, picomatch 2.3.2 → 2.3.2, 4.0.7, pretty-ms 8.0.0 → 9.3.1, slash 4.0.0 → 5.1.0, string-width 4.2.3, 5.1.2 → 4.2.3, 5.1.2, 7.2.0 and 2 more. Your build may pick other versions.

Breaking8
Removes the "sticky" .only() behavior.
.only()
Watch mode can no longer be started via the ava.config.* or package.json configuration.
ava.config.*package.json
Modules loaded through the require configuration now have their default export function invoked, and local files load through @ava/typescript if necessary.
require@ava/typescript
When tests finish, worker threads or child processes are no longer exited through process.exit().
process.exit()
The ignoredByWatcher configuration has moved to the watchMode object, under the ignoreChanges key.
ignoredByWatcherwatchModeignoreChanges
Watch mode now uses the built-in fs.watch() in recursive mode, supported on Linux in Node.js 20+ and macOS and Windows in Node.js 18+.
fs.watch()
Only native errors are now considered errors by the t.throws() and t.throwsAsync() assertions.
t.throws()t.throwsAsync()Object.create(Error.prototype)
Failed assertions now throw, meaning any subsequent code is not executed, which also impacts the type definitions.
Platform3
Adds Node.js 23 to supported engines and the test matrix.
Adds Node.js 22 to supported engines and the test matrix.
AVA now requires Node.js 18.18, 20.8 or 21; versions 14 and 16 are no longer supported.

Generated by DepDelta from published .d.ts files. Not mixed with prose notes.

  • added: type Event = StateChangeEvent
  • added: type ObservedRun = { events: AsyncIterableIterator<Event> }
  • removed: export * from '../types/assertions'
  • removed: export * from '../types/subscribable'
  • removed: export * from '../types/test-fn'
  • removed: export * from '../types/try-fn'
  • added: const registerCompletionHandler: (handler: () => void) => void
  • changed: type AssertAssertion = { (actual: any, message?: string): boolean; skip(actual: any, message?: string): void } → type AssertAssertion = { <T>(actual: T, message?: string): actual is T extends Falsy<T> ? never : T; skip(actual: any, message?: string): void }
  • changed: type ErrorConstructor<ErrorType extends Error = Error> = { new (...args: any[]): ErrorType; readonly prototype: ErrorType } → type ErrorConstructor<ErrorType extends Error = Error> = { readonly prototype: ErrorType; new (...args: any[]): ErrorType }
  • changed: type FailAssertion = { (message?: string): boolean; skip(message?: string): void } → type FailAssertion = { (message?: string): never; skip(message?: string): void }
  • changed: type FalsyAssertion = { (actual: any, message?: string): boolean; skip(actual: any, message?: string): void } → type FalsyAssertion = { <T>(actual: T, message?: string): actual is Falsy<T>; skip(actual: any, message?: string): void }
  • changed: type NotAssertion = { <Actual, Expected>(actual: Actual, expected: Expected, message?: string): boolean; skip(actual: any, expected: any, message?: string): void } → type NotAssertion = { <Actual, Expected>(actual: Actual, expected: Expected, message?: string): true; skip(actual: any, expected: any, message?: string): void }
  • changed: type NotDeepEqualAssertion = { <Actual, Expected>(actual: Actual, expected: Expected, message?: string): boolean; skip(actual: any, expected: any, message?: string): void } → type NotDeepEqualAssertion = { <Actual, Expected>(actual: Actual, expected: Expected, message?: string): true; skip(actual: any, expected: any, message?: string): void }
  • changed: type NotRegexAssertion = { (string: string, regex: RegExp, message?: string): boolean; skip(string: string, regex: RegExp, message?: string): void } → type NotRegexAssertion = { (string: string, regex: RegExp, message?: string): true; skip(string: string, regex: RegExp, message?: string): void }
  • changed: type NotThrowsAssertion = { (fn: () => any, message?: string): void; skip(fn: () => any, message?: string): void } → type NotThrowsAssertion = { (fn: () => any, message?: string): true; skip(fn: () => any, message?: string): void }
  • changed: type NotThrowsAsyncAssertion = { (fn: () => PromiseLike<any>, message?: string): Promise<void>; (promise: PromiseLike<any>, message?: string): Promise<void>; skip(nonThrower: any, message?:… → type NotThrowsAsyncAssertion = { (fn: () => PromiseLike<any>, message?: string): Promise<true>; (promise: PromiseLike<any>, message?: string): Promise<true>; skip(nonThrower: any, message?:…
  • changed: type PassAssertion = { (message?: string): boolean; skip(message?: string): void } → type PassAssertion = { (message?: string): true; skip(message?: string): void }
  • changed: type RegexAssertion = { (string: string, regex: RegExp, message?: string): boolean; skip(string: string, regex: RegExp, message?: string): void } → type RegexAssertion = { (string: string, regex: RegExp, message?: string): true; skip(string: string, regex: RegExp, message?: string): void }
  • changed: type SnapshotAssertion = { (expected: any, message?: string): void; skip(expected: any, message?: string): void } → type SnapshotAssertion = { (expected: any, message?: string): true; skip(expected: any, message?: string): void }
  • changed: type ThrowsAssertion = { <ErrorType extends ErrorConstructor | Error>(fn: () => any, expectations?: ThrowsExpectation<ErrorType>, message?: string): ThrownError<ErrorType> | undefine… → type ThrowsAssertion = { <ErrorType extends ErrorConstructor | Error>(fn: () => any, expectations?: ThrowsExpectation<ErrorType>, message?: string): ThrownError<ErrorType>; (fn: () =…
  • changed: type ThrowsExpectation<ErrorType extends ErrorConstructor | Error> = { code?: string | number; instanceOf?: ErrorType extends ErrorConstructor ? ErrorType : ErrorType extends Error ? ErrorConstructor<ErrorType> : never; is?: Err… → type ThrowsExpectation<ErrorType extends ErrorConstructor | Error> = { any?: false; code?: string | number; instanceOf?: ErrorType extends ErrorConstructor ? ErrorType : ErrorType extends Error ? ErrorConstructor<ErrorType> : ne…
  • changed: type TruthyAssertion = { (actual: any, message?: string): boolean; skip(actual: any, message?: string): void } → type TruthyAssertion = { <T>(actual: T, message?: string): actual is T extends Falsy<T> ? never : T; skip(actual: any, message?: string): void }
  • added: type ThrowsAnyExpectation = Omit<ThrowsExpectation<any>, 'any' | 'instanceOf' | 'is'> & { any: true; instanceOf?: new (...args: any[]) => any; is?: any }
  • changed: type SharedWorker.FactoryOptions = { negotiateProtocol <Data = unknown>(supported: readonly ['ava-4']): Protocol<Data> } → type SharedWorker.FactoryOptions = { negotiateProtocol<Data = unknown>(supported: readonly ['ava-4']): Protocol<Data> }
  • added: type StateChangeEvent = { type: 'starting'; testFile: string } | { type: 'stats'; stats: { byFile: Map<string, { declaredTests: number; failedHooks: number; failedTests: number; inter…
  • changed: type TimeoutFn = (ms: number, message?: string) => void → type TimeoutFn = { (ms: number, message?: string): void; clear(): void }