📖 Step 7: Testing & Quality#204 / 291

Code Coverage

Code Coverage

📖One-line summary

A metric showing what percentage of the code is exercised by tests.

Example

Measures what % of code the tests exercise

1function login(email, pw) {
2 if (!email) return null;
3 if (!pw) return null;
4 const user = db.find(email);
5 if (!user) throw Error();
6 return createToken(user);
7}

Vibe coding prompt examples

>_

Add config to generate Jest test coverage reports. Fail CI if coverage is below 80%.

>_

Find files with low test coverage and build a priority list of files to write tests for first.

Try these prompts in your AI coding assistant!