avajs/ava · error · TypeError

`todo` tests are not allowed to have an implementation. Use

Error message

`todo` tests are not allowed to have an implementation. Use `test.skip()` for tests with an implementation.

What it means

Runner guard for todo declarations: test.todo('title', implementation) was called with an implementation function, but todo tests are placeholders without bodies. The erroneous input is the second (implementation) argument passed alongside a .todo() declaration.

Source

Thrown at lib/runner.js:108

			}

			if (!scheduledStart) {
				scheduledStart = true;
				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,

View on GitHub (pinned to bbfd946322)

Solutions

  1. Drop the implementation: use test.todo('title') only
  2. Use test.skip('title', impl) when the test has a body you want recorded as skipped
  3. Keep planned-work notes in todo entries without function bodies
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/runner.js:108 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/83cf68db70a7f98f. Report an issue: GitHub.