{"record":{"id":"875170f367bff26c","repo":"jestjs/jest","slug":"error-each-called-with-a-tagged-template-liter","errorCode":null,"errorMessage":"Error: `.each` called with a Tagged Template Literal with no data, remember to interpolate with ${expression} syntax.\n","messagePattern":"Error: `\\.each` called with a Tagged Template Literal with no data, remember to interpolate with (.+?) syntax\\.\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-each/src/validation.ts","lineNumber":36,"sourceCode":"export const validateArrayTable = (table: unknown): void => {\n  if (!Array.isArray(table)) {\n    throw new TypeError(\n      '`.each` must be called with an Array or Tagged Template Literal.\\n\\n' +\n        `Instead was called with: ${pretty(table, {\n          maxDepth: 1,\n          min: true,\n        })}\\n`,\n    );\n  }\n\n  if (isTaggedTemplateLiteral(table)) {\n    if (isEmptyString(table[0])) {\n      throw new Error(\n        'Error: `.each` called with an empty Tagged Template Literal of table data.\\n',\n      );\n    }\n\n    throw new Error(\n      'Error: `.each` called with a Tagged Template Literal with no data, remember to interpolate with ${expression} syntax.\\n',\n    );\n  }\n\n  if (isEmptyTable(table)) {\n    throw new Error(\n      'Error: `.each` called with an empty Array of table data.\\n',\n    );\n  }\n};\n\nconst isTaggedTemplateLiteral = (array: any) => array.raw !== undefined;\nconst isEmptyTable = (table: Array<unknown>) => table.length === 0;\nconst isEmptyString = (str: string | unknown) =>\n  typeof str === 'string' && str.trim() === '';\n\nexport const validateTemplateTableArguments = (\n  headings: Array<string>,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-each/src/validation.ts#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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`.","solutions":["Add interpolated expressions after the header row: `` test.each`a | b\\n ${1} | ${2}` ``.","Ensure there is a newline between the header and the first data row.","Switch to array syntax if the template syntax is confusing: `test.each([[1, 2]])`."],"exampleFix":"// before — header but no data\ntest.each`a | b`('test $a', ({a}) => {});\n\n// after — header with interpolated data\ntest.each`a | b\n  ${1} | ${2}\n  ${3} | ${4}`('test $a', ({a, b}) => {});","handlingStrategy":"validation","validationCode":"// Check that a tagged template .each has interpolated data\nfunction validateTemplateHasData(templateStrings, dataCount) {\n  if (templateStrings.length > 1 && dataCount === 0) {\n    throw new Error('Tagged template .each has headings but no interpolated data');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After writing the header row, always add interpolated ${value} expressions.","Review the .each block for completeness before running tests.","Use array-of-arrays syntax as an alternative if template syntax is error-prone."],"tags":["jest-each","parameterized-tests","validation","tagged-template"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}