From ca50958b3480c8d3fd27cc9bb4af20f29c74b02a Mon Sep 17 00:00:00 2001 From: AriPerkkio Date: Wed, 3 May 2023 18:58:21 +0300 Subject: [PATCH] fix: support new vitest typings --- package.json | 1 + pnpm-lock.yaml | 25 +++++++++++++++++++++++++ src/vitest/register.ts | 5 +++++ 3 files changed, 31 insertions(+) diff --git a/package.json b/package.json index 873c49d..983326e 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "@types/node": "^18.16.3", "@typescript-eslint/eslint-plugin": "^5.59.2", "@typescript-eslint/parser": "^5.59.2", + "@vitest/expect": "^0.30.1", "esbuild": "^0.17.18", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d1aa656..66206a5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ devDependencies: '@typescript-eslint/parser': specifier: ^5.59.2 version: 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@vitest/expect': + specifier: ^0.30.1 + version: 0.30.1 esbuild: specifier: ^0.17.18 version: 0.17.18 @@ -736,6 +739,14 @@ packages: eslint-visitor-keys: 3.4.0 dev: true + /@vitest/expect@0.30.1: + resolution: {integrity: sha512-c3kbEtN8XXJSeN81iDGq29bUzSjQhjES2WR3aColsS4lPGbivwLtas4DNUe0jD9gg/FYGIteqOenfU95EFituw==} + dependencies: + '@vitest/spy': 0.30.1 + '@vitest/utils': 0.30.1 + chai: 4.3.7 + dev: true + /@vitest/expect@0.31.0: resolution: {integrity: sha512-Jlm8ZTyp6vMY9iz9Ny9a0BHnCG4fqBa8neCF6Pk/c/6vkUk49Ls6UBlgGAU82QnzzoaUs9E/mUhq/eq9uMOv/g==} dependencies: @@ -761,12 +772,26 @@ packages: pretty-format: 27.5.1 dev: true + /@vitest/spy@0.30.1: + resolution: {integrity: sha512-YfJeIf37GvTZe04ZKxzJfnNNuNSmTEGnla2OdL60C8od16f3zOfv9q9K0nNii0NfjDJRt/CVN/POuY5/zTS+BA==} + dependencies: + tinyspy: 2.1.0 + dev: true + /@vitest/spy@0.31.0: resolution: {integrity: sha512-IzCEQ85RN26GqjQNkYahgVLLkULOxOm5H/t364LG0JYb3Apg0PsYCHLBYGA006+SVRMWhQvHlBBCyuByAMFmkg==} dependencies: tinyspy: 2.1.0 dev: true + /@vitest/utils@0.30.1: + resolution: {integrity: sha512-/c8Xv2zUVc+rnNt84QF0Y0zkfxnaGhp87K2dYJMLtLOIckPzuxLVzAtFCicGFdB4NeBHNzTRr1tNn7rCtQcWFA==} + dependencies: + concordance: 5.0.4 + loupe: 2.3.6 + pretty-format: 27.5.1 + dev: true + /@vitest/utils@0.31.0: resolution: {integrity: sha512-kahaRyLX7GS1urekRXN2752X4gIgOGVX4Wo8eDUGUkTWlGpXzf5ZS6N9RUUS+Re3XEE8nVGqNyxkSxF5HXlGhQ==} dependencies: diff --git a/src/vitest/register.ts b/src/vitest/register.ts index c74b2b9..f17ccbf 100644 --- a/src/vitest/register.ts +++ b/src/vitest/register.ts @@ -12,6 +12,11 @@ interface ToBeAnnouncedMatchers { toBeAnnounced(politenessSetting?: Exclude): void; } +declare module '@vitest/expect' { + interface Assertion extends ToBeAnnouncedMatchers {} +} + +// For Vitest below 0.31.x declare global { namespace Vi { interface Assertion extends ToBeAnnouncedMatchers {}