jestjs/jest · error · Error

Error: `.each` called with a Tagged Template Literal with…

Error message

Error: `.each` called with a Tagged Template Literal with no data, remember to interpolate with ${expression} syntax.

What it means

Thrown when `.each` receives a tagged template literal that has text content (so `table[0]` is not empty) but contains no interpolated expressions (`${...}`). Without interpolated data, there are no test rows to generate. The error message reminds the developer to use `${expression}` syntax.

Solutions

  1. Add interpolated expressions after the header row: `` test.each`a | b\n ${1} | ${2}` ``.
  2. Ensure there is a newline between the header and the first data row.
  3. Switch to array syntax if the template syntax is confusing: `test.each([[1, 2]])`.

Example fix

// before — header but no data
test.each`a | b`('test $a', ({a}) => {});

// after — header with interpolated data
test.each`a | b
  ${1} | ${2}
  ${3} | ${4}`('test $a', ({a, b}) => {});
Defensive patterns

Strategy: validation

Validate before calling

// Check that a tagged template .each has interpolated data
function validateTemplateHasData(templateStrings, dataCount) {
  if (templateStrings.length > 1 && dataCount === 0) {
    throw new Error('Tagged template .each has headings but no interpolated data');
  }
}

Prevention

When it happens

Trigger: Writing `` test.each`a | b` `` — this is a tagged template with heading text but zero interpolated values. The template produces `['a | b']` with `.raw = ['a | b']`, `table[0]` is not empty (so error 85 is skipped), but there are no data interpolations.

Common situations: Forgetting to interpolate data values after writing the header row. Starting to write a table-driven test and not finishing the data section. Misunderstanding the tagged template syntax for `.each`.

Related errors


AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10). Data as JSON: /api/errors/875170f367bff26c. Report an issue: GitHub.

Appendix: source

Thrown at packages/jest-each/src/validation.ts:36

export const validateArrayTable = (table: unknown): void => {
  if (!Array.isArray(table)) {
    throw new TypeError(
      '`.each` must be called with an Array or Tagged Template Literal.\n\n' +
        `Instead was called with: ${pretty(table, {
          maxDepth: 1,
          min: true,
        })}\n`,
    );
  }

  if (isTaggedTemplateLiteral(table)) {
    if (isEmptyString(table[0])) {
      throw new Error(
        'Error: `.each` called with an empty Tagged Template Literal of table data.\n',
      );
    }

    throw new Error(
      'Error: `.each` called with a Tagged Template Literal with no data, remember to interpolate with ${expression} syntax.\n',
    );
  }

  if (isEmptyTable(table)) {
    throw new Error(
      'Error: `.each` called with an empty Array of table data.\n',
    );
  }
};

const isTaggedTemplateLiteral = (array: any) => array.raw !== undefined;
const isEmptyTable = (table: Array<unknown>) => table.length === 0;
const isEmptyString = (str: string | unknown) =>
  typeof str === 'string' && str.trim() === '';

export const validateTemplateTableArguments = (
  headings: Array<string>,

View on GitHub (pinned to 8e6d128e4a)