Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import { test as base, expect } from "vitest";
type Fixture = { simple: string, nested: string, notArrow1: string, notArrow2: string, notArrow3: string,}
const test = base.extend<Fixture>({ simple: async ({}, use) => { await use("simple"); }, nested: async ({ simple }, use) => { await use("nested:" + simple); }, async notArrow1({}, use) { await use("notArrow1"); }, notArrow2: async function({}, use) { await use("notArrow2"); }, notArrow3: async function notArrow3({}, use) { await use("notArrow3"); }});
test("test sync", ({ simple, nested }) => { expect(simple).toBe("simple"); expect(nested).toBe("nested:simple")});
test("test async", async ({ simple, nested }) => { expect(simple).toBe("simple"); expect(nested).toBe("nested:simple")});
test.for([1, 2])("test.for sync %i", (i, { expect, simple, nested }) => { expect(i).toBeTypeOf("number") expect(simple).toBe("simple"); expect(nested).toBe("nested:simple")})
test.for([1, 2])("test.for async %i", async (i, { expect, simple, nested }) => { expect(i).toBeTypeOf("number") expect(simple).toBe("simple"); expect(nested).toBe("nested:simple")})
test("test notArrow", async function ({ notArrow1, notArrow2, notArrow3 }) { expect(notArrow1).toMatchInlineSnapshot(`"notArrow1"`) expect(notArrow2).toMatchInlineSnapshot(`"notArrow2"`) expect(notArrow3).toMatchInlineSnapshot(`"notArrow3"`)});