Focus a JS Test 0 ▲ Jake Worth 1 hour ago · Tech · hide · 0 comments A vital testing skill is focusing a test. When iterating on a failing test, we want that test under microscope. The way I do this in JavaScript is .only: import {describe, expect, test} from 'vitest'; import {sum} from './sum.js'; test('adds 1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(3); }); describe.only('adding fours', () => { test('adds 4 + 4 to equal 8', () => { expect(sum(4, 4)).toBe(8); }); }); No comments yet. Log in to reply on the Fediverse. Comments will appear here.