@hyperfrontend/project-scope/tech/testingtesting
Testing-framework detectors for the unit, integration, and e2e tools commonly used in JavaScript/TypeScript projects.
Covers Jest, Vitest, Mocha, Cypress, and Playwright. Each <tool>Detector follows the shared TestingFrameworkDetector contract and pairs with a <TOOL>_CONFIG_PATTERNS constant describing the config-file shapes it recognizes. detectTestingFrameworks runs all detectors against the project and returns the aggregate TestingFrameworkDetection[].
API Reference
ƒ Functions
Detect Cypress in project.
Parameters
Returns
TestingFrameworkDetectionDetection result or null if not detected
Example
Detecting Cypress testing framework
import { cypressDetector } from '@hyperfrontend/project-scope'
const result = cypressDetector('./my-project')
if (result) {
console.log(`Cypress ${result.version} detected (${result.confidence}% confidence)`)
// => "Cypress 13.6.0 detected (95% confidence)"
}§function
detectTestingFrameworks(projectPath: string, packageJson?: PackageJson): TestingFrameworkDetection[]
Detect all testing frameworks in project.
Parameters
Returns
TestingFrameworkDetection[]Array of detected testing frameworks, sorted by confidence
Example
Detecting multiple testing frameworks
import { detectTestingFrameworks } from '@hyperfrontend/project-scope'
const frameworks = detectTestingFrameworks('./my-project')
// => [
// { id: 'jest', name: 'Jest', type: 'unit', confidence: 95, ... },
// { id: 'cypress', name: 'Cypress', type: 'e2e', confidence: 85, ... }
// ]
// Results are sorted by confidence (highest first)
const primary = frameworks[0]?.name ?? 'None'
console.log(`Primary testing framework: ${primary}`)Detect Jest in project.
Parameters
Returns
TestingFrameworkDetectionDetection result or null if not detected
Example
Detecting Jest testing framework
import { jestDetector } from '@hyperfrontend/project-scope'
const result = jestDetector('./my-project')
if (result) {
console.log(`Jest ${result.version} detected`)
console.log('Sources:', result.detectedFrom.map(s => s.type))
// => "Sources: ['package.json', 'config-file']"
}Detect Mocha in project.
Parameters
Returns
TestingFrameworkDetectionDetection result or null if not detected
Example
Detecting Mocha testing framework
import { mochaDetector } from '@hyperfrontend/project-scope'
const result = mochaDetector('./my-project')
if (result) {
console.log(`Mocha ${result.version} detected (${result.confidence}%)`)
// => "Mocha 10.2.0 detected (95%)"
}§function
playwrightDetector(projectPath: string, packageJson?: PackageJson): TestingFrameworkDetection
Detect Playwright in project.
Parameters
Returns
TestingFrameworkDetectionDetection result or null if not detected
Example
Detecting Playwright testing framework
import { playwrightDetector } from '@hyperfrontend/project-scope'
const result = playwrightDetector('./my-project')
if (result) {
console.log(`Playwright ${result.version} (${result.type} tests)`)
// => "Playwright 1.42.0 (e2e tests)"
}Detect Vitest in project.
Parameters
Returns
TestingFrameworkDetectionDetection result or null if not detected
Example
Detecting Vitest testing framework
import { vitestDetector } from '@hyperfrontend/project-scope'
const result = vitestDetector('./my-project')
if (result) {
console.log(`Vitest ${result.version} detected`)
console.log('Config:', result.configPath)
// => "Config: vitest.config.ts"
}◈ Interfaces
Testing framework detection result.
● Variables
Config patterns for Cypress
Config patterns for Jest
Config patterns for Mocha
Config patterns for Playwright
All testing framework detectors
Config patterns for Vitest