import { test as base, expect } from '@playwright/test'; type TodoStore = { items: string[]; add(item: string): void; clear(): void; }; export const test = base.extend<{ todoStore: TodoStore }>({ todoStore: async ({}, use, testInfo) => { const items: string[] = []; const todoStore: TodoStore = { items, add(item: string) { items.push(item); }, clear() { items.splice(0, items.length); }, }; console.log('setup ' + testInfo.title); await use(todoStore); todoStore.clear(); console.log('teardown ' + testInfo.title); }, }); export { expect };