A codebase with no test files has no automated verification that the core logic works correctly after a change. Every refactor, dependency upgrade, or new feature becomes a manual regression risk. ISO 25010:2011 §6.5.5 identifies absence of test infrastructure as a reliability defect. For AI-built projects specifically, the lack of tests is a compounding risk: the original author may not remember the edge cases, and future changes can silently break behavior that was never encoded as an assertion.
Medium because absent tests mean every change ships with no automated regression check, making regressions in business logic invisible until a user reports them.
Set up a test framework appropriate for your stack. For Next.js/React with TypeScript, Vitest + Testing Library is the standard starting point.
npm install -D vitest @testing-library/react @testing-library/user-event jsdom
Add to package.json:
{
"scripts": {
"test": "vitest",
"test:coverage": "vitest run --coverage"
}
}
Create your first test co-located with the module it covers:
// src/lib/format-price.test.ts
import { describe, it, expect } from 'vitest'
import { formatPrice } from './format-price'
describe('formatPrice', () => {
it('formats a whole dollar amount', () => {
expect(formatPrice(1000)).toBe('$10.00')
})
it('returns "Free" for zero', () => {
expect(formatPrice(0)).toBe('Free')
})
})
ID: code-quality-essentials.testing.test-files-present
Severity: medium
What to look for: Search the project for test files using these patterns: **/*.test.ts, **/*.test.tsx, **/*.spec.ts, **/*.spec.tsx, **/__tests__/**. Estimate the ratio of test files to source files — aim for at least 50% of business logic modules having a corresponding test. Check whether tests are co-located with source files (e.g., utils/parse.ts and utils/parse.test.ts side-by-side) or collected in a __tests__ directory. Examine package.json for a test script — its absence suggests testing is not part of the development workflow. Also check whether a test framework (jest, vitest, mocha) is present in devDependencies.
Pass criteria: Test files are present covering at least 50% of business logic modules. A test script is defined in package.json. A test framework is in devDependencies.
Fail criteria: No test files found anywhere in the project, or only placeholder/skeleton test files with no actual assertions.
Skip (N/A) when: Project is purely a static asset collection with no custom code logic (no JavaScript/TypeScript modules).
Detail on fail: "No test files (*.test.ts, *.spec.ts, __tests__/) found; testing framework not configured in package.json"
Remediation: Set up a test framework appropriate for your stack. For Next.js/React with TypeScript, Vitest or Jest with Testing Library is standard:
npm install -D vitest @testing-library/react @testing-library/user-event jsdom
Add to package.json:
{
"scripts": {
"test": "vitest",
"test:coverage": "vitest run --coverage"
}
}
Create your first test alongside the module it covers:
// src/lib/format-price.test.ts
import { describe, it, expect } from 'vitest'
import { formatPrice } from './format-price'
describe('formatPrice', () => {
it('formats a whole dollar amount', () => {
expect(formatPrice(1000)).toBe('$10.00')
})
it('returns "Free" for zero', () => {
expect(formatPrice(0)).toBe('Free')
})
})