VoiceGem

How to dictate a Jest or Vitest test case

A JavaScript test case is a quoted sentence, an arrow function and an expectation, which suits dictation because the quoted sentence is ordinary English. VoiceGem turns “it open paren double quote returns the user double quote comma async open paren close paren fat arrow open brace” into a complete case header.

A seventeen-word test header takes about 20 seconds to type and about 6.2 seconds to say. (sources: Dhakal, Feit, Kristensson & Oulasvirta, “Observations on Typing from 136 Million Keystrokes”, CHI 2018, 168,000 participants, 136 million keystrokes; Yuan, Liberman & Cieri, “Towards an Integrated Understanding of Speaking Rate in Conversation”, Interspeech 2006, 2,438 American English telephone conversations (Switchboard corpus). The speech figure is conversational rate, not a measured dictation rate — no such measurement exists.)

What lands in your editor
it("returns the cached user on a second call", async() => {

This tool runs entirely in your browser. Nothing you type is sent anywhere, stored, or logged.

Step by step

  1. 1

    Open the case with “it open paren double quote”

    Speak the three phrases together. The quote binds forward onto the first word of the test name, so the sentence starts flush inside the literal.

  2. 2

    Say the test name as ordinary English

    Speak a full sentence describing the behaviour. Words outside VoiceGem's lookup table pass through untouched, which is why a descriptive test name is the easiest thing in the file to dictate.

  3. 3

    Close the literal and add the callback

    Say “double quote comma async open paren close paren fat arrow open brace”. Every character lands in order, and the only artifact is the missing space after async.

  4. 4

    Typing it instead

    Use your editor's test snippet, which generates the whole skeleton from three keystrokes. Snippets beat dictation for the boilerplate and lose to it for the test name.

The test name is the part of a JavaScript test worth dictating

Descriptive test names are long English sentences, and long English sentences are the shape the Deterministic Pass handles best — every word outside the table passes through untouched, so a fifteen-word behaviour description costs fifteen spoken words and no punctuation phrases at all.

Editor snippets already generate the skeleton around it. The honest division of labour is that a snippet writes the brackets and VoiceGem writes the sentence, which is why this page recommends using both rather than choosing between them.

Where the manual way breaks

Typing a short test name is fine and a snippet writes the structure. For a three-word test description nothing here is faster.

Long behavioural names are where typing gets skipped. Test names get shortened because they are tedious to type, and a shortened test name is the one you cannot interpret when it fails six months later. Dictating the full sentence in VoiceGem costs the same as saying it, which removes the incentive to abbreviate.

Doing this somewhere else? the full speech-to-code converter, dictating JSDoc comments, dictating JavaScript functions specifically, or naming things in JavaScript by voice.

Common questions

Only if you want to. An editor snippet generates the describe and it skeleton faster than speaking it; dictate the test name inside it.

No. Words absent from VoiceGem's table pass through untouched, so an English sentence inside the quotes arrives exactly as spoken.

The open parenthesis attaches on both sides, which is right for a call and wrong after a keyword. Prettier closes it on save.

Dictate a twenty-word test name and see it land inside the quotes.

Open the tool