Screenshot of terminal (iTerm on macOS) showing a split-pane layout with code on the left and the results of an `npm run -s t` command on the right. The results on the right: 🍌️ All tests passing! Total 8 Passing 8 Failing 0 Duration 2.15 secs The code on the left: // @ts-check import test from 'tape' import { getDocument } from './helpers/Browser.js' import { Kitten } from './helpers/Kitten.js' async function testNthDocumentLoad (t, n) { const document = await getDocument(t, 'https://localhost') t.equal(document.title, 'Kitten count example', 'Title is set') const paragraphs = document.getElementsByTagName('p') t.equal(paragraphs.length, 1, 'There is one paragraph tag') t.equal(paragraphs[0]?.innerHTML, '🐱️'.repeat(n), 'Expected number of kittens found') } test('kitten count', async t => { // Start Kitten. const kitten = await Kitten.serverRunningAt({ path: 'examples/kitten-count', log: false }) // Load the document twice and test that the general // structure and kitten count are as we expect them to be. await testNthDocumentLoad(t, 1) await testNthDocumentLoad(t, 2) // Stop Kitten. await kitten.stop() t.end() })
https://s3-eu-central-1.amazonaws.com/mastodon-aral/media_attachments/files/113/363/214/778/655/133/original/60dd8b9c31f2e4ee.png