Principle:Cypress io Cypress Framework and Bundler Detection
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Component_Testing |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A dependency-scanning algorithm that identifies both the UI framework and language used by a project to auto-configure the Cypress setup wizard.
Description
During project setup, Cypress needs to know the project's framework, bundler, and language (JavaScript or TypeScript). This detection extends beyond the component-testing-focused detectFramework by also including detectLanguage, which examines config file extensions and project dependencies to determine if TypeScript is in use.
The combined detection result drives the scaffolding step: which config file template to generate, which support file to create, and which dev server to configure.
Usage
Use this principle during the project setup wizard when the user selects a testing type and Cypress needs to auto-detect the project's technology stack.
Theoretical Basis
Combined Detection:
1. detectFramework(projectPath, CT_FRAMEWORKS)
→ { framework, bundler }
2. detectLanguage({ projectRoot, customConfigFile, pkgJson })
→ 'js' | 'ts'
Language Detection Algorithm:
If cypress.config.ts exists → 'ts'
If cypress.config.js exists → 'js'
If neither → check package.json for 'typescript' dependency
If found → 'ts'
Else → 'js'