angular/angular-cli · error · SchematicsException

No files ending with '${fileSuffix}' found in ${searchScope}

Error message

No files ending with '${fileSuffix}' found in ${searchScope}.

What it means

Thrown by the jasmine-vitest refactor after collecting candidate test files when the resulting list is empty. It reports which scope was searched (the explicit include path or the project root) and the required file suffix (default .spec.ts), so the developer knows what was not found.

Source

Thrown at packages/schematics/angular/refactor/jasmine-vitest/index.ts:114

      // Approximation of a directory exists check
      if (dirEntry && (dirEntry.subdirs.length > 0 || dirEntry.subfiles.length > 0)) {
        // It is a directory
        files = findTestFiles(dirEntry, fileSuffix);
      } else if (tree.exists(includePath)) {
        // It is a file
        files = [includePath];
      } else {
        throw new SchematicsException(
          `The specified include path '${options.include}' does not exist.`,
        );
      }
    } else {
      searchScope = `project '${projectName}'`;
      files = findTestFiles(tree.getDir(projectRoot), fileSuffix);
    }

    if (files.length === 0) {
      throw new SchematicsException(
        `No files ending with '${fileSuffix}' found in ${searchScope}.`,
      );
    }

    for (const file of files) {
      reporter.incrementScannedFiles();
      const content = tree.readText(file);
      const newContent = transformJasmineToVitest(file, content, reporter, {
        addImports: !!options.addImports,
        browserMode: !!options.browserMode,
        fakeAsync: !!options.fakeAsync,
      });

      if (content !== newContent) {
        tree.overwrite(file, newContent);
        reporter.incrementTransformedFiles();
      }
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Verify test files exist and match the suffix; pass --suffix=test.ts if your files are *.test.ts.
  2. Rename spec files to end with the expected suffix (e.g. .spec.ts).
  3. Point --include at the directory that actually contains the test files.
  4. Omit --include to scan the entire project root.

Example fix

// before
ng ref jasmine-vitest --suffix=spec.ts
// after
ng ref jasmine-vitest --suffix=.spec.ts --include src/app
Defensive patterns

Strategy: validation

Validate before calling

const specs = glob.sync(`**/*${suffix}`, { cwd: projectRoot, ignore: ['node_modules/**'] });
if (specs.length === 0) {
  throw new Error(`No files ending '${suffix}' under ${projectRoot}; nothing to migrate.`);
}

Try / catch

try {
  await runJasmineVitestRefactor(opts);
} catch (e) {
  if (String(e.message).includes('No files ending')) {
    console.error('Check the file suffix (pass --suffix) and the include scope.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running the refactor when findTestFiles returns zero files — the --include directory contains no files with the given suffix, or the project directory contains no *.spec.ts (or custom --suffix) files.

Common situations: Projects whose tests use .test.ts naming while the tool expects .spec.ts; tests already migrated to Vitest; include directory pointing at source without specs; misconfigured test file naming conventions.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/93a97b6fa803fbba. Report an issue: GitHub.