From 117156a78b02819af57d07b9eac331a98bb36f24 Mon Sep 17 00:00:00 2001 From: Huey Lee Date: Tue, 26 Dec 2023 14:09:14 +0800 Subject: [PATCH] fix: tests --- .eslintrc.js | 1 + jest.config.ts | 5 +++-- package.json | 1 + pnpm-lock.yaml | 25 +++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e430d94..9ff0112 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,6 +24,7 @@ module.exports = { `sort-keys-fix`, `import`, `react-hooks`, + `jest`, ], processor: `disable/disable`, root: true, diff --git a/jest.config.ts b/jest.config.ts index 1a5ade3..478e7f0 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,6 +1,7 @@ +import type { Config } from 'jest' import { defaults } from 'jest-config' -const config = { +const config: Config = { moduleDirectories: [ `node_modules`, `src`, @@ -27,7 +28,7 @@ const config = { "^.+\\.svg$": `/tests/svgTransform.js`, }, transformIgnorePatterns: [ - `node_modules/(?!(leven|@testing-library/preact|preact)/)`, + `/node_modules/.pnpm/(?!(leven|@testing-library\\+preact|preact)@)`, ], } diff --git a/package.json b/package.json index 6bd4d10..aa565b7 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "eslint-config-preact": "^1.3.0", "eslint-plugin-disable": "^2.0.3", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jest": "^27.6.0", "eslint-plugin-json-format": "^2.0.1", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-node": "^11.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b8751c..b89ede4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,6 +130,9 @@ devDependencies: eslint-plugin-import: specifier: ^2.29.1 version: 2.29.1(@typescript-eslint/parser@6.16.0)(eslint@8.56.0) + eslint-plugin-jest: + specifier: ^27.6.0 + version: 27.6.0(@typescript-eslint/eslint-plugin@6.16.0)(eslint@8.56.0)(jest@29.7.0)(typescript@5.3.3) eslint-plugin-json-format: specifier: ^2.0.1 version: 2.0.1(eslint@8.56.0) @@ -4885,6 +4888,28 @@ packages: - typescript dev: true + /eslint-plugin-jest@27.6.0(@typescript-eslint/eslint-plugin@6.16.0)(eslint@8.56.0)(jest@29.7.0)(typescript@5.3.3): + resolution: {integrity: sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@typescript-eslint/eslint-plugin': ^5.0.0 || ^6.0.0 + eslint: ^7.0.0 || ^8.0.0 + jest: '*' + peerDependenciesMeta: + '@typescript-eslint/eslint-plugin': + optional: true + jest: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 6.16.0(@typescript-eslint/parser@6.16.0)(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 5.62.0(eslint@8.56.0)(typescript@5.3.3) + eslint: 8.56.0 + jest: 29.7.0(@types/node@20.10.5)(ts-node@10.9.2) + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /eslint-plugin-json-format@2.0.1(eslint@8.56.0): resolution: {integrity: sha512-eWT0sNqIEYzKqbej2dvz+/oQ4JQxthE3i+izjInIdfbsPfVgBtiWbmagkgKStje0LJqo9FATx1LWl6xcuxqsBQ==} engines: {node: '>=0.10.0'}