{"record":{"id":"f94f010af50fd1fb","repo":"microsoft/TypeScript","slug":"provided-test-options-exceeded-the-maximum-number","errorCode":null,"errorMessage":"Provided test options exceeded the maximum number of variations: ${varyBy.map(v => `'@${v}'`).join(\", \")}","messagePattern":"Provided test options exceeded the maximum number of variations: (.+?)'`\\)\\.join\\(\", \"\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/harnessIO.ts","lineNumber":1175,"sourceCode":"            })));\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n * Compute FileBasedTestConfiguration variations based on a supplied list of variable settings.\r\n */\r\nexport function getFileBasedTestConfigurations(settings: TestCaseParser.CompilerSettings, varyBy: readonly string[]): FileBasedTestConfiguration[] | undefined {\r\n    let varyByEntries: [string, string[]][] | undefined;\r\n    let variationCount = 1;\r\n    for (const varyByKey of varyBy) {\r\n        if (ts.hasProperty(settings, varyByKey)) {\r\n            // we only consider variations when there are 2 or more variable entries.\r\n            const entries = splitVaryBySettingValue(settings[varyByKey], varyByKey);\r\n            if (entries) {\r\n                if (!varyByEntries) varyByEntries = [];\r\n                variationCount *= entries.length;\r\n                if (variationCount > 25) throw new Error(`Provided test options exceeded the maximum number of variations: ${varyBy.map(v => `'@${v}'`).join(\", \")}`);\r\n                varyByEntries.push([varyByKey, entries]);\r\n            }\r\n        }\r\n    }\r\n\r\n    if (!varyByEntries) return undefined;\r\n\r\n    const configurations: FileBasedTestConfiguration[] = [];\r\n    computeFileBasedTestConfigurationVariations(configurations, /*variationState*/ {}, varyByEntries, /*offset*/ 0);\r\n    return configurations;\r\n}\r\n\r\n/**\r\n * Compute a description for this configuration based on its entries\r\n */\r\nexport function getFileBasedTestConfigurationDescription(configuration: FileBasedTestConfiguration): string {\r\n    let name = \"\";\r\n    if (configuration) {\r","sourceCodeStart":1157,"sourceCodeEnd":1193,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/harnessIO.ts#L1157-L1193","documentation":"Thrown in getFileBasedTestConfigurations (harnessIO.ts:1175) when the cross-product of all `@<varyBy>` settings exceeds 25. The harness caps the variation matrix to keep combinatorial explosion bounded; the running product `variationCount *= entries.length` is checked after each dimension is added.","triggerScenarios":"A test file stacks several varyBy directives — e.g. `@module`, `@target`, `@jsx`, `@moduleResolution` — whose value counts multiply past 25 (5 x 6 = 30 already trips it). The thrown message lists every key in `varyBy` joined with commas.","commonSituations":"Adding a new varyBy dimension to a test that already had several; expanding an option's value list (e.g. target across es5/es6/es2015..esnext); bulk test generation that combines many options.","solutions":["Reduce the number of values in one or more `@<varyBy>` directives so the product is at most 25.","Split the single test file into two or more files, each covering a subset of the variation dimensions.","Remove the least important varyBy dimension entirely.","Use `exclude=` to drop values you do not need from a high-cardinality option."],"exampleFix":"// before — 6 targets x 5 modules = 30 > 25\n// @target: es5,es6,es2015,es2017,es2019,esnext\n// @module: commonjs,es2015,system,amd,umd\n\n// after — trim to 5 x 5 = 25\n// @target: es5,es6,es2017,es2019,esnext\n// @module: commonjs,es2015,system,amd,umd","handlingStrategy":"validation","validationCode":"// Pre-compute the cross-product size and surface a clearer error before the harness throws.\nfunction variationProduct(varyByEntries: [string, string[]][]): number {\n  return varyByEntries.reduce((acc, [, vals]) => acc * vals.length, 1);\n}\nconst product = variationProduct(myVaryByEntries);\nif (product > 25) {\n  throw new Error(`Refactor the test: ${product} variations > 25 cap. Split files or trim a dimension.`);\n}","typeGuard":"function isWithinVariationCap(varyByEntries: [string, string[]][], cap = 25): boolean {\n  return varyByEntries.reduce((acc, [, v]) => acc * v.length, 1) <= cap;\n}","tryCatchPattern":null,"preventionTips":["Keep the running product of varyBy value lists at or below 25.","Split a high-dimensional test across multiple files rather than one large matrix.","Use exclude= to drop unneeded values from high-cardinality options like target."],"tags":["test-harness","test-options","varyby","combinatorial"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}