{"record":{"id":"3b4cefd7e7dd85e8","repo":"cypress-io/cypress","slug":"no-spec-pattern-match","errorCode":"NO_SPEC_PATTERN_MATCH","errorMessage":"Unable to determine testing type, spec does not match any configured specPattern","messagePattern":"Unable to determine testing type, spec does not match any configured specPattern","errorType":"error_code","errorClass":"RunSpecError","httpStatus":null,"severity":"error","filePath":"packages/data-context/src/actions/ProjectActions.ts","lineNumber":539,"sourceCode":"      }\n\n      if (!specPath) {\n        throw new RunSpecError('NO_SPEC_PATH', '`specPath` must be a non-empty string')\n      }\n\n      let targetTestingType: TestingType\n\n      // Get relative path from the specPath to determine which testing type from the specPattern\n      const relativeSpecPath = path.relative(this.ctx.currentProject, specPath)\n\n      // Check to see whether input specPath matches the specPattern for one or the other testing type\n      // If it matches neither then we can't run the spec and we should error\n      if (await this.ctx.project.matchesSpecPattern(relativeSpecPath, 'e2e')) {\n        targetTestingType = 'e2e'\n      } else if (await this.ctx.project.matchesSpecPattern(relativeSpecPath, 'component')) {\n        targetTestingType = 'component'\n      } else {\n        throw new RunSpecError('NO_SPEC_PATTERN_MATCH', 'Unable to determine testing type, spec does not match any configured specPattern')\n      }\n\n      debug(`Spec %s matches '${targetTestingType}' pattern`, specPath)\n\n      debug('Attempting to launch spec %s', specPath)\n\n      // Look to see if there's actually a file at the target location\n      // This helps us avoid switching testingType *then* finding out the spec doesn't exist\n      if (!this.ctx.fs.existsSync(specPath)) {\n        throw new RunSpecError('SPEC_NOT_FOUND', `No file exists at path ${specPath}`)\n      }\n\n      // We now know what testingType we need to be in - if we're already there, great\n      // If not, verify that type is configured then switch (or throw an error if not configured)\n      if (this.ctx.coreData.currentTestingType !== targetTestingType) {\n        if (!this.ctx.lifecycleManager.isTestingTypeConfigured(targetTestingType)) {\n          throw new RunSpecError('TESTING_TYPE_NOT_CONFIGURED', `Input path matched specPattern for '${targetTestingType}' testing type, but it is not configured.`)\n        }","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/packages/data-context/src/actions/ProjectActions.ts#L521-L557","documentation":"Thrown by ProjectActions.runSpec (ProjectActions.ts:538-540) with code NO_SPEC_PATTERN_MATCH after path.relative(currentProject, specPath) is checked against both the e2e specPattern and the component specPattern via matchesSpecPattern and matches neither. The specPattern globs (from cypress.config e2e.specPattern / component.specPattern) define which files count as specs for each testing type; a path that fits neither cannot be assigned a testing type and is rejected. Returned as { code: 'NO_SPEC_PATTERN_MATCH', detailMessage }.","triggerScenarios":"Passing runSpec a specPath whose path relative to the project root does not match either the configured e2e.specPattern or component.specPattern globs. Example: spec lives outside cypress/e2e (or src for CT), or has an extension the pattern excludes.","commonSituations":"Custom specPattern in cypress.config that narrows which files are specs; a file placed in a directory not covered by the pattern; renamed/moved spec whose new location is outside the glob; mismatched file extension (e.g. *.spec.ts when pattern is *.cy.*); pointing runSpec at a non-spec helper file.","solutions":["Check your cypress.config e2e.specPattern / component.specPattern and move the file into a directory the glob matches.","Adjust the specPattern to include the file's location/extension, or restore the default (cypress/e2e for e2e, and the CT src root).","Confirm specPath is absolute and relative-to-project resolves to the intended file (a wrong project root makes every path 'not match').","If you intended to run a file Cypress doesn't treat as a spec, rename it to match the pattern (e.g. add the .cy.* suffix)."],"exampleFix":"// before (cypress.config.js)\n// e2e: { specPattern: 'cypress/e2e/**/*.cy.{js,ts}' }\n// spec at ./tests/login.spec.ts -> NO_SPEC_PATTERN_MATCH\n\n// after\n// e2e: { specPattern: ['cypress/e2e/**/*.cy.{js,ts}', 'tests/**/*.spec.{js,ts}'] }","handlingStrategy":"validation","validationCode":"// Pre-check the specPattern match before calling runSpec\nconst projectRoot = ctx.currentProject\nif (projectRoot) {\n  const rel = path.relative(projectRoot, specPath)\n  const isE2E = await ctx.project.matchesSpecPattern(rel, 'e2e')\n  const isCT = await ctx.project.matchesSpecPattern(rel, 'component')\n  if (!isE2E && !isCT) {\n    // tell the user the file is outside both specPatterns; do not call runSpec\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the e2e.specPattern and component.specPattern in cypress.config aligned with where your spec files actually live.","When moving/renaming specs, confirm the new path still matches the configured glob before expecting runSpec to accept it.","Use .cy.* (or your configured) extensions consistently so files are recognized as specs."],"tags":["runspec","spec-pattern","configuration","glob","testing-type"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}