{"record":{"id":"2dccdc6bd55a6df5","repo":"cypress-io/cypress","slug":"no-file-name-specified-this-is-required-to-genera","errorCode":null,"errorMessage":"No file name specified. This is required to generate a new Cypress file.","messagePattern":"No file name specified\\. This is required to generate a new Cypress file\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"npm/cypress-schematic/src/schematics/ng-generate/cypress-test/index.ts","lineNumber":53,"sourceCode":"  return async (tree: Tree) => {\n    const host = createSpec(tree)\n    const { workspace } = await workspaces.readWorkspace('/', host)\n    const testType = options.component ? 'component' : 'e2e'\n\n    let project\n\n    if (!options.project) {\n      project = workspace.projects.get(workspace.extensions.defaultProject as string)\n    } else {\n      project = workspace.projects.get(options.project)\n    }\n\n    if (!project) {\n      throw new SchematicsException(`Invalid project name: ${options.project}`)\n    }\n\n    if (options.name === undefined) {\n      throw new SchematicsException(`No file name specified. This is required to generate a new Cypress file.`)\n    }\n\n    if (options.path === undefined) {\n      options.path = testType === 'component' ? `${project.sourceRoot}/${project.prefix}` : `${project.root}/cypress/e2e`\n    }\n\n    console.log(`Creating new ${testType} spec named: ${options.name}`)\n\n    const templatePath = testType === 'component' ? '../files/ct/__path__' : '../files/e2e/__path__'\n    const templateSource = createTemplate({ templatePath, options })\n\n    return chain([\n      mergeWith(templateSource),\n    ])\n  }\n}\n","sourceCodeStart":35,"sourceCodeEnd":70,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/cypress-schematic/src/schematics/ng-generate/cypress-test/index.ts#L35-L70","documentation":"Raised by the cypress-test ng-generate schematic when options.name is undefined. The name becomes the spec file name in the generated template (the templates use __path__/name substitution), so without it the schematic cannot produce a file. The schematic checks this after resolving the project, so a valid project is required first.","triggerScenarios":"Running `ng generate @cypress/schematic:cypress-test --project app` with no --name flag, or an Angular CLI invocation that does not forward the positional name argument into options.name.","commonSituations":"Forgetting the --name flag; a wrapper script that constructs the schematic command without a name; a CLI alias that strips the positional argument.","solutions":["Pass a name: `ng generate @cypress/schematic:cypress-test --project app --name <spec-name>`.","If using the positional form, ensure the name argument is forwarded: `ng g @cypress/schematic:cypress-test <name> --project app`.","Check that a custom schematic alias or script template includes the --name option."],"exampleFix":"# before: ng g @cypress/schematic:cypress-test --project app\n# after: ng g @cypress/schematic:cypress-test --project app --name login","handlingStrategy":"validation","validationCode":"function assertName(options: { name?: string }) {\n  if (options.name === undefined || options.name === '') {\n    throw new Error('--name is required to generate a Cypress spec')\n  }\n  return options.name\n}","typeGuard":"function hasName(o: { name?: string }): o is { name: string } {\n  return typeof o.name === 'string' && o.name.length > 0\n}","tryCatchPattern":null,"preventionTips":["Always pass --name (or the positional name) when invoking the cypress-test schematic.","Validate options in wrapper scripts that build schematic commands.","Document the required --name flag for your team's generators."],"tags":["angular","schematic","ng-generate","validation"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}