Switch workflows to Bun install/test and update pnpm

This commit is contained in:
Esdras Renan 2025-11-04 23:21:41 -03:00
parent c3237dfb64
commit 775956c160
37 changed files with 2618 additions and 113 deletions

View file

@ -1,6 +1,19 @@
import { expect, test } from "vitest"
import { expect, test } from "bun:test"
test("CTA button snapshot", async () => {
type ScreenshotMatcher = {
toMatchScreenshot: (name: string) => Promise<unknown> | unknown
}
function isScreenshotMatcher(value: unknown): value is ScreenshotMatcher {
return typeof value === "object" && value !== null && "toMatchScreenshot" in value &&
typeof (value as ScreenshotMatcher).toMatchScreenshot === "function"
}
const matcherProbe = expect({}) as unknown
const hasScreenshotMatcher = isScreenshotMatcher(matcherProbe)
const testFn = hasScreenshotMatcher ? test : test.skip
testFn("CTA button snapshot", async () => {
const html = `
<main
style="
@ -36,5 +49,8 @@ test("CTA button snapshot", async () => {
const ctaButton = document.querySelector("[data-testid='cta']")
expect(ctaButton).toBeTruthy()
await expect(document.body).toMatchScreenshot("cta-button")
const bodyExpectation = expect(document.body) as unknown
if (isScreenshotMatcher(bodyExpectation)) {
await bodyExpectation.toMatchScreenshot("cta-button")
}
})