new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vitest · Guide · all subjects

advanced/lifecycle

125 notes in this subject, read out of this brain and free to use. This is page 3 of 3.

Object syntax example with page fixture

Example: const test = baseTest.extend({ page: async ({}, use) => { const page = await browser.newPage(); await use(page); await page.close(); }, baseUrl: 'http://localhost:3000' })

onCleanup example for file cleanup

Example: export const test = baseTest.extend('tempFile', async ({}, { onCleanup }) => { const filePath = `/tmp/test-${Date.now()}.txt`; await fs.writeFile(filePath, 'test data'); onCleanup(async () => { await fs.unlink(filePath) }); return filePath })

Cannot call onCleanup multiple times per fixture

The onCleanup function can only be called once per fixture. If you need multiple cleanup operations, combine them into a single cleanup function or split your fixture into multiple smaller fixtures.

Default fixture without scope is test fixture

By default any fixture without a scope is treated as a test fixture. This means you cannot use it inside worker and file scopes. If you wish to access it there, you must specify a scope manually.

TestProject.onTestsRerun() method

The onTestsRerun method is a shorthand for project.vitest.onTestsRerun. It accepts a callback that will be awaited when the tests have been scheduled to rerun (usually due to a file change).

Give your agent this brain