avajs/ava · error · TypeError

`todo` tests require a title

Error message

`todo` tests require a title

What it means

Runner guard: test.todo() was called without a non-empty title (undefined, empty string, or otherwise falsy). A todo entry exists solely to be listed by name, so a title is mandatory. The input at fault is the missing or falsy title argument.

Source

Thrown at lib/runner.js:112

				process.nextTick(() => {
					hasStarted = true;
					this.start();
				});
			}

			metadata.taskIndex = this.nextTaskIndex++;

			const {args, implementation, title} = parseTestArgs(testArgs);

			metadata.selected &&= this.checkSelectedByLineNumbers?.() ?? true;

			if (metadata.todo) {
				if (implementation) {
					throw new TypeError('`todo` tests are not allowed to have an implementation. Use `test.skip()` for tests with an implementation.');
				}

				if (!title.raw) { // Either undefined or a string.
					throw new TypeError('`todo` tests require a title');
				}

				if (!this.registerUniqueTitle(title.value)) {
					throw new Error(`Duplicate test title: ${title.value}`);
				}

				// --match selects TODO tests.
				metadata.selected &&= isTitleMatch(title.value, this.matchPatterns);

				this.tasks.todo.push({title: title.value, metadata});
				this.emit('stateChange', {
					type: 'declared-test',
					title: title.value,
					knownFailing: false,
					todo: true,
				});
			} else {
				if (typeof implementation !== 'function') {

View on GitHub (pinned to bbfd946322)

Solutions

  1. Provide a descriptive string title: test.todo('implement parser edge case')
  2. Generate titles before declaring if they are dynamic
  3. Remove the todo call if there is nothing to describe
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/runner.js:112 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of avajs/ava@bbfd946322 (2026-09-02). Data as JSON: /api/errors/d2b48a991aac8f79. Report an issue: GitHub.