Performance: Test steps for organized output
This concept affects how quickly test results are displayed and how efficiently test output is processed and rendered in the console or UI.
for (const test of tests) { const result = await test.run(); console.log(`Test: ${test.name} - Result: ${result}`); }
for (const test of tests) { console.log('Running test:', test.name); const result = await test.run(); console.log('Result:', result); console.log('---------------------'); }
| Pattern | Console Writes | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple separate console.logs per test | Many writes | Multiple reflows | High paint cost | [X] Bad |
| Single combined console.log per test | One write | Single reflow | Low paint cost | [OK] Good |
deno.test?deno.test function to define tests with a name and a function.deno.test matches the correct syntax; others are invalid or do not exist.deno.test('Sum test', () => {
const a = 2;
const b = 3;
const result = a + b;
if (result !== 5) throw new Error('Sum failed');
});result !== 5 is false, so no error is thrown.deno.test('Check value', () => {
const val = 10
if val !== 10 {
throw new Error('Value mismatch')
}
});val !== 10, which is required in JavaScript/TypeScript.if (val !== 10) { ... } to correct the syntax.Pass the test and this pattern moves unknown