Loading docs/examples/tsconfig.json +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ "allowJs": true, "checkJs": true, "skipLibCheck": true, "alwaysStrict": true, "esModuleInterop": true, "noImplicitAny": true, Loading package-lock.json +2 −2 Original line number Diff line number Diff line Loading @@ -93,10 +93,10 @@ }, "peerDependencies": { "@jest/globals": "^29.0.3 || ^30.0.0", "@vitest/expect": "^3.0.0 || ^4.0.1", "@vitest/expect": "^3.2.0 || ^4.0.1", "jest": "^29.0.3 || ^30.0.0", "jest-snapshot": "^29.0.3 || ^30.0.0", "vitest": "^3.0.0 || ^4.0.1" "vitest": "^3.2.0 || ^4.0.1" }, "peerDependenciesMeta": { "@jest/globals": { Loading package.json +2 −2 Original line number Diff line number Diff line Loading @@ -285,10 +285,10 @@ }, "peerDependencies": { "@jest/globals": "^29.0.3 || ^30.0.0", "@vitest/expect": "^3.0.0 || ^4.0.1", "@vitest/expect": "^3.2.0 || ^4.0.1", "jest": "^29.0.3 || ^30.0.0", "jest-snapshot": "^29.0.3 || ^30.0.0", "vitest": "^3.0.0 || ^4.0.1" "vitest": "^3.2.0 || ^4.0.1" }, "peerDependenciesMeta": { "@jest/globals": { Loading src/vitest/augmentation.ts +68 −4 Original line number Diff line number Diff line Loading @@ -43,10 +43,74 @@ declare module "vitest" { * * @since 8.5.0 */ toHTMLValidate(filename?: string): T; toHTMLValidate(config: ConfigData, filename?: string): T; toHTMLValidate(error: Partial<Message>, filename?: string): T; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): T; toHTMLValidate(filename?: string): Promise<void>; toHTMLValidate(config: ConfigData, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares * with snapshot. * * * Requires Vitest v4.1.3 or later. * * @since 11.2.0 */ toMatchCodeframe(hint?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares * with inline snapshot. * * Requires Vitest v4.1.3 or later. * * @since 11.2.0 */ toMatchInlineCodeframe(snapshot?: string): Promise<void>; } /* eslint-disable-next-line @typescript-eslint/no-explicit-any -- to match upstream */ interface Matchers<T = any> { /** * @since 8.5.0 */ toBeValid(): Promise<void>; /** * @since 8.5.0 */ toBeInvalid(): Promise<void>; /** * @since 8.5.0 */ toHaveError(error: Partial<Message>): T; /** * @since 8.5.0 */ toHaveError(ruleId: string, message: string, context?: unknown): T; /** * @since 8.5.0 */ toHaveErrors(errors: Array<[string, string] | Record<string, unknown>>): T; /** * Validate string or HTMLElement. * * Test passes if result is valid. * * @param config - Optional HTML-Validate configuration object. * @param filename - Optional filename used when matching transformer and * loading configuration. * * @since 8.5.0 */ toHTMLValidate(filename?: string): Promise<void>; toHTMLValidate(config: ConfigData, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares Loading src/vitest/matchers/to-have-error.vitest.ts +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import { reportError, reportErrorAsync } from "./__fixtures__"; import { toHaveError } from "./to-have-error"; expect.extend({ /* @ts-expect-error technical debt, vitest/jest types clashes */ toHaveError: toHaveError(expect), }); Loading Loading
docs/examples/tsconfig.json +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ "allowJs": true, "checkJs": true, "skipLibCheck": true, "alwaysStrict": true, "esModuleInterop": true, "noImplicitAny": true, Loading
package-lock.json +2 −2 Original line number Diff line number Diff line Loading @@ -93,10 +93,10 @@ }, "peerDependencies": { "@jest/globals": "^29.0.3 || ^30.0.0", "@vitest/expect": "^3.0.0 || ^4.0.1", "@vitest/expect": "^3.2.0 || ^4.0.1", "jest": "^29.0.3 || ^30.0.0", "jest-snapshot": "^29.0.3 || ^30.0.0", "vitest": "^3.0.0 || ^4.0.1" "vitest": "^3.2.0 || ^4.0.1" }, "peerDependenciesMeta": { "@jest/globals": { Loading
package.json +2 −2 Original line number Diff line number Diff line Loading @@ -285,10 +285,10 @@ }, "peerDependencies": { "@jest/globals": "^29.0.3 || ^30.0.0", "@vitest/expect": "^3.0.0 || ^4.0.1", "@vitest/expect": "^3.2.0 || ^4.0.1", "jest": "^29.0.3 || ^30.0.0", "jest-snapshot": "^29.0.3 || ^30.0.0", "vitest": "^3.0.0 || ^4.0.1" "vitest": "^3.2.0 || ^4.0.1" }, "peerDependenciesMeta": { "@jest/globals": { Loading
src/vitest/augmentation.ts +68 −4 Original line number Diff line number Diff line Loading @@ -43,10 +43,74 @@ declare module "vitest" { * * @since 8.5.0 */ toHTMLValidate(filename?: string): T; toHTMLValidate(config: ConfigData, filename?: string): T; toHTMLValidate(error: Partial<Message>, filename?: string): T; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): T; toHTMLValidate(filename?: string): Promise<void>; toHTMLValidate(config: ConfigData, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares * with snapshot. * * * Requires Vitest v4.1.3 or later. * * @since 11.2.0 */ toMatchCodeframe(hint?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares * with inline snapshot. * * Requires Vitest v4.1.3 or later. * * @since 11.2.0 */ toMatchInlineCodeframe(snapshot?: string): Promise<void>; } /* eslint-disable-next-line @typescript-eslint/no-explicit-any -- to match upstream */ interface Matchers<T = any> { /** * @since 8.5.0 */ toBeValid(): Promise<void>; /** * @since 8.5.0 */ toBeInvalid(): Promise<void>; /** * @since 8.5.0 */ toHaveError(error: Partial<Message>): T; /** * @since 8.5.0 */ toHaveError(ruleId: string, message: string, context?: unknown): T; /** * @since 8.5.0 */ toHaveErrors(errors: Array<[string, string] | Record<string, unknown>>): T; /** * Validate string or HTMLElement. * * Test passes if result is valid. * * @param config - Optional HTML-Validate configuration object. * @param filename - Optional filename used when matching transformer and * loading configuration. * * @since 8.5.0 */ toHTMLValidate(filename?: string): Promise<void>; toHTMLValidate(config: ConfigData, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, filename?: string): Promise<void>; toHTMLValidate(error: Partial<Message>, config: ConfigData, filename?: string): Promise<void>; /** * Writes out the given [[Report]] using codeframe formatter and compares Loading
src/vitest/matchers/to-have-error.vitest.ts +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import { reportError, reportErrorAsync } from "./__fixtures__"; import { toHaveError } from "./to-have-error"; expect.extend({ /* @ts-expect-error technical debt, vitest/jest types clashes */ toHaveError: toHaveError(expect), }); Loading