From 08b94d8e0630665ac9467d9a75b11bb1e22ce9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Thu, 9 Jan 2025 15:42:56 +0100 Subject: [PATCH] Removed jest --- packages/frontend/__tests__/setupTests.ts | 8 - packages/frontend/__tests__/testData.ts | 226 ---------------------- packages/frontend/eslint.config.js | 40 ---- packages/frontend/jest.config.js | 24 --- packages/frontend/package-lock.json | 8 - packages/frontend/package.json | 15 +- 6 files changed, 3 insertions(+), 318 deletions(-) delete mode 100644 packages/frontend/__tests__/setupTests.ts delete mode 100644 packages/frontend/__tests__/testData.ts delete mode 100644 packages/frontend/jest.config.js diff --git a/packages/frontend/__tests__/setupTests.ts b/packages/frontend/__tests__/setupTests.ts deleted file mode 100644 index 13e414ea4..000000000 --- a/packages/frontend/__tests__/setupTests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { createSerializer } from "@emotion/jest"; -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; - -expect.addSnapshotSerializer(createSerializer()); diff --git a/packages/frontend/__tests__/testData.ts b/packages/frontend/__tests__/testData.ts deleted file mode 100644 index 5209737cf..000000000 --- a/packages/frontend/__tests__/testData.ts +++ /dev/null @@ -1,226 +0,0 @@ -import type { ProjectListings } from "../src/interfaces/ProjectListings"; - -export const testData: ProjectListings = { - projects: [ - { - info: { - description: - 'Galerie obrázků a videí z Google Disku je plugin pro WordPress, který propojí web s Google Diskem. V pluginu se dá vybrat libovolná složku na Google Disku nebo ve Sdíleném disku a plugin z ní vytvoří galerii s obrázky a videi na libovolné stránce či příspěvku na webu. Ze všech složek a podsložek jsou navíc vytvořeny vnořené “podgalerie”. Plugin vzniknul primárně pro potřeby Junáka, oddílů a středisek, ale vyvíjíme ho tzv. Open-Source (otevřeně pro veřejnost) a nabízíme ho v oficiální databázi pluginů pro WordPress. V tuto chvíli (léto 2021) podle statistik WordPressu plugin běží na víc jak 4 000 webových stránek a z kontaktů s uživateli víme, že ho využívají jak oddíly a střediska v Junáku, tak i "náhodná veřejnost" - zvlášť oblíbený se zdá být u skautů z celého světa a profesionálních fotografů, prezentujících svoje fotky.', - links: [ - { - type: "email", - uri: "mailto:mlha@skaut.cz", - }, - { - type: "homepage", - uri: "https://wordpress.org/plugins/skaut-google-drive-gallery/", - }, - { - type: "demo", - uri: "https://demo-skaut-google-drive-gallery.skauting.cz/", - }, - { - type: "issue-tracker", - uri: "https://github.com/skaut/skaut-google-drive-gallery/issues", - }, - { - type: "docs", - uri: "https://napoveda.skaut.cz/dobryweb/cs-skaut-google-drive-gallery", - }, - { - name: "skaut/skaut-google-drive-gallery", - type: "github-repo", - uri: "https://github.com/skaut/skaut-google-drive-gallery", - }, - ], - maintainers: [ - { - email: "mlha@skaut.cz", - name: "Marek Dědič – Mlha", - }, - ], - name: "WordPress plugin: Galerie obrázků a videí z Google Disku", - "short-description": - "Plugin pro WordPress, který ze složek s fotkami na Google Disku dělá galerie na webu.", - tags: ["wordpress", "php", "javascript", "google"], - }, - issues: [ - { - description: - 'When editing and selecting a folder with videos, the editor could display a notice that setting videos to "Anyone can view" will speed them up.\r\n\r\nDepends on #792', - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/873", - number: 1, - title: "Add hint to set videos to public", - }, - { - description: - "When in a situation that there is a Google Drive shortcut somewhere in the gallery, the plugin displays the folder and it works for browsing. However, when looking at the shortcut as a member of its parent directory and when being inside the directory and looking at its name in the breadcrumbs, one uses the shortcut name, whereas the other uses the original folder name (when they differ).\r\n\r\nThis is a bug and both should show the shortcut name.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/745", - number: 2, - title: - "If a shortcut name differs from the original, the name in gallery and breadcrumbs differs", - }, - { - description: - "When opening the editor which contains a gallery that is made from a folder that has been renamed or deleted, the editor breaks. It shows: `Directory "Galerie ODYWEB" wasn't found - it may have been deleted or renamed.` Instead, it should verify that the path is valid and if it's not, should display a warning (and possibly move you to either the root directory, or the closest valid ancestor - however, this should not lead to you accidentally changing the gallery!)\r\n\r\nLast tested on 36dc1a10a353ba5bf2b98f33b49b1135a36ae3d3", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/683", - number: 3, - title: "Editing doesn't check path validity", - }, - { - description: - "Ctrl+click on a gallery item (subfolder) or breadcrumbs should open in a new tab", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/571", - number: 4, - title: "Ctrl-click on folders does not work", - }, - { - description: - "https://wordpress.org/support/topic/folder-link-instead-of-folder-name/\r\n\r\nBasically, instead of searching for the folder in WP, you'd just paste the link to it into the editor and the plugin would figure out the path (Google Drive files now return a list of parents, so it could be done.)\r\n\r\nDepends on #111.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/311", - number: 5, - title: "Add option to specify gallery by a Drive link", - }, - { - description: - "Currently, images aren't listed in the editor - both block and TinyMCE plugin. This often confuses users.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/257", - number: 6, - title: "Add images to the block", - }, - { - description: - "In the image grid, we should add an overlay to signify that an item is a video (for example a big play icon).", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/235", - number: 7, - title: "Add video overlay", - }, - { - description: "https://codecov.io/gh/skaut/skaut-google-drive-gallery", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/164", - number: 8, - title: "Increase test coverage", - }, - { - description: - "If the active theme contains\r\n```php\r\nadd_theme_support( 'editor-styles' );\r\n```\r\nits styles are also applied to the block editor, which then looks weird. We should implement our own styles for the editor.\r\n\r\nExample of such theme is the Twenty Seventeen theme.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/98", - number: 9, - title: - 'Themes with "editor-styles" support change the look of the block editor', - }, - { - description: - "https://napoveda.skaut.cz/dobryweb/en-skaut-google-drive-gallery/en-get-google-application\r\nhttps://napoveda.skaut.cz/dobryweb/cs-skaut-google-drive-gallery/cs-ziskani-google-aplikace\r\n\r\nGoogle changed the consent screen layout and require some form of verification.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/92", - number: 10, - title: "Google app creation manual is outdated", - }, - { - description: - "Currently, the first image in a directory is used for its preview.", - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/54", - number: 11, - title: "Directory preview images", - }, - { - description: - 'Go over the design of:\r\n- [ ] gallery view https://github.com/skaut/skaut-google-drive-gallery/issues/36\r\n- [ ] preview\r\n- [ ] folder thumbnail - overlay, folder title and image count\r\n- [ ] svg folder icon\r\n- [ ] gallery breadcrumbs\r\n- [ ] options page\r\n- [ ] WP.org plugin page\r\n- [ ] TinyMCE & Gutenberg editor plugins\r\n- [ ] TinyMCE & Gutenberg "Authentication failed" dialogs\r\n\r\nEverything on the frontend needs to work at least with the default WP template and DSW templates.', - link: "https://github.com/skaut/skaut-google-drive-gallery/issues/33", - number: 12, - title: "UX & design audit", - }, - ], - owner: "skaut", - repo: "skaut-google-drive-gallery", - }, - { - info: { - description: - "Plugin zajišťuje propojení skautských webů se skautISem. Dá se přes plugin registrovat, přihlašovat. Dokáže u stránek nastavovat oprávnění podle roli a dalších nastavení ve skautISu. Skrývá obsah podle toho jaká pravidla na stránce jsou nastavená.", - links: [ - { - type: "email", - uri: "mailto:kalich@skaut.cz", - }, - { - type: "homepage", - uri: "https://wordpress.org/plugins/skautis-integration/", - }, - { - type: "issue-tracker", - uri: "https://github.com/skaut/skautis-integration/issues", - }, - { - type: "docs", - uri: "https://napoveda.skaut.cz/skautis/skautis-integration", - }, - { - name: "skaut/skautis-integration", - type: "github-repo", - uri: "https://github.com/skaut/skautis-integration", - }, - ], - maintainers: [ - { - email: "kalich@skaut.cz", - name: "Michal Janata – Kalich", - }, - { - email: "mlha@skaut.cz", - name: "Marek Dědič – Mlha", - }, - ], - name: "WordPress plugin: SkautIS integrace", - "short-description": - "Plugin pro WordPress, který napojuje přihlašování přes skautIS na skautské weby.", - tags: ["wordpress", "php", "javascript", "skautis"], - }, - issues: [ - { - description: "", - link: "https://github.com/skaut/skautis-integration/issues/115", - number: 1, - title: - "User management smart table is not smart when the registration module is enabled", - }, - { - description: - "![image](https://user-images.githubusercontent.com/8988898/130583907-9aaf6288-2129-42dd-88ef-0a27b0c7ddd1.png)\r\n", - link: "https://github.com/skaut/skautis-integration/issues/109", - number: 2, - title: "Chyba v zobrazení", - }, - { - description: - "Musíme pořešit, jak nejlépe integrovat náš plugin s WP 5.x a hlavně Gutenbergem.\r\n\r\nSkrývání bloků, celých stránek... atd", - link: "https://github.com/skaut/skautis-integration/issues/70", - number: 3, - title: "WordPress 5.x + Gutenberg", - }, - { - description: - "Co do WordPressu tahat i profilové fotky, co si lidi do skautISu přidávají. Aby u profilu nějakou fotku měli...", - link: "https://github.com/skaut/skautis-integration/issues/43", - number: 4, - title: "Profilové fotky", - }, - { - description: "Přidat Select2 do výběru pravidel v shortcode.", - link: "https://github.com/skaut/skautis-integration/issues/39", - number: 5, - title: "Výběry pravidel v shortcode", - }, - { - description: - "modul pro nábory se zobrazením náborové mapy\r\npříklad: http://is.skaut.cz/napoveda/programatori.Hotove-reseni-MapAdvertising-Interaktivni-mapa-naborovych-informaci-zakladni.ashx\r\n\r\nOtevírám k tomu diskuzi...", - link: "https://github.com/skaut/skautis-integration/issues/25", - number: 6, - title: 'Modul "Nábory"', - }, - ], - owner: "skaut", - repo: "skautis-integration", - }, - ], -}; diff --git a/packages/frontend/eslint.config.js b/packages/frontend/eslint.config.js index fbef9b3c2..34dba11d9 100644 --- a/packages/frontend/eslint.config.js +++ b/packages/frontend/eslint.config.js @@ -3,7 +3,6 @@ import commentsConfig from "@eslint-community/eslint-plugin-eslint-comments/conf import js from "@eslint/js"; import vitest from "@vitest/eslint-plugin"; import compat from "eslint-plugin-compat"; -import jest from "eslint-plugin-jest"; import perfectionist from "eslint-plugin-perfectionist"; import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions"; import prettierRecommended from "eslint-plugin-prettier/recommended"; @@ -32,7 +31,6 @@ export default tseslint.config( }, plugins: { "eslint-comments": eslintComments, - jest, "prefer-arrow-functions": preferArrowFunctions, }, rules: { @@ -257,44 +255,6 @@ export default tseslint.config( "vitest/valid-expect-in-promise": "error", }, }, - { - ...jest.configs["flat/recommended"], - ...jest.configs["flat/style"], - files: ["__tests__/**/*.test.ts", "__test__/**/*.test.tsx"], - rules: { - ...jest.configs["flat/recommended"].rules, - ...jest.configs["flat/style"].rules, - "jest/consistent-test-it": ["error", { withinDescribe: "test" }], - "jest/no-conditional-in-test": "error", - "jest/no-confusing-set-timeout": "error", - "jest/no-duplicate-hooks": "error", - "jest/no-test-return-statement": "error", - "jest/no-untyped-mock-factory": "error", - "jest/padding-around-all": "error", - "jest/prefer-called-with": "error", - "jest/prefer-comparison-matcher": "error", - "jest/prefer-each": "error", - "jest/prefer-equality-matcher": "error", - "jest/prefer-expect-assertions": [ - "error", - { - onlyFunctionsWithAsyncKeyword: true, - onlyFunctionsWithExpectInCallback: true, - onlyFunctionsWithExpectInLoop: true, - }, - ], - "jest/prefer-expect-resolves": "error", - "jest/prefer-hooks-in-order": "error", - "jest/prefer-hooks-on-top": "error", - "jest/prefer-jest-mocked": "error", - "jest/prefer-mock-promise-shorthand": "error", - "jest/prefer-spy-on": "error", - "jest/prefer-strict-equal": "error", - "jest/require-hook": "error", - "jest/require-to-throw-message": "error", - "jest/unbound-method": "error", - }, - }, { files: ["*.config.js", "*.config.ts"], languageOptions: { diff --git a/packages/frontend/jest.config.js b/packages/frontend/jest.config.js deleted file mode 100644 index 7f84e983e..000000000 --- a/packages/frontend/jest.config.js +++ /dev/null @@ -1,24 +0,0 @@ -/** @type {import('jest').Config} */ -export default { - collectCoverage: true, - collectCoverageFrom: [ - "src/**/*.{ts,tsx}", - "!src/index.tsx", - "!src/config.ts", - "!src/globalStyles.ts", - ], - moduleNameMapper: { - "\\.svg$": "/__mocks__/fileMock.ts", - }, - resetMocks: true, - setupFilesAfterEnv: ["/__tests__/setupTests.ts"], - testEnvironment: "jsdom", - testMatch: ["/__tests__/**/*.test.{js,jsx,ts,tsx}"], - transform: { - "^.+\\.(j|t)sx?$": ["ts-jest", { tsconfig: "test.tsconfig.json" }], - }, - transformIgnorePatterns: [ - "node_modules/(?!react-markdown)/", - "node_modules/@testing-library/", - ], -}; diff --git a/packages/frontend/package-lock.json b/packages/frontend/package-lock.json index e74da21e8..669fe8725 100644 --- a/packages/frontend/package-lock.json +++ b/packages/frontend/package-lock.json @@ -20,13 +20,10 @@ "swr": "^2.3.0" }, "devDependencies": { - "@emotion/jest": "^11.13.0", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint/js": "^9.17.0", - "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", - "@types/jest": "^29.5.14", "@types/react-dom": "^18.3.1", "@types/react-test-renderer": "^19.0.0", "@vitejs/plugin-legacy": "^5.4.3", @@ -36,20 +33,15 @@ "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-compat": "^6.0.2", - "eslint-plugin-jest": "^28.10.0", "eslint-plugin-perfectionist": "^4.6.0", "eslint-plugin-prefer-arrow-functions": "^3.4.1", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.3", "globals": "^15.14.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jest-mock": "^29.7.0", "jsdom": "^26.0.0", "npm-run-all": "^4.1.5", "prettier": "^3.4.1", "rimraf": "^6.0.1", - "ts-jest": "^29.2.5", "typescript": "^5.5.4", "typescript-eslint": "^8.19.1", "vite": "^5.4.11", diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 6c32c1479..dffb31b20 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -20,14 +20,13 @@ "clean": "rimraf dist/*", "prebuild": "npm run clean", "build": "vite build", - "lint:ts:eslint": "eslint --color \"src/**/*\" \"__mocks__/**/*\" \"tests/**/*\" \"__tests__/**/*\" \"*.config.{js,ts}\"", + "lint:ts:eslint": "eslint --color \"src/**/*\" \"__mocks__/**/*\" \"tests/**/*\" \"*.config.{js,ts}\"", "lint:ts:typecheck": "tsc --noEmit", "lint:ts": "run-p -c --aggregate-output lint:ts:*", "lint": "run-p -c --aggregate-output lint:*", "start": "vite", - "test": "jest", - "vitest": "vitest", - "test-accept": "jest --updateSnapshot" + "test": "vitest", + "test-accept": "vitest run --update" }, "dependencies": { "@emotion/react": "^11.14.0", @@ -42,13 +41,10 @@ "swr": "^2.3.0" }, "devDependencies": { - "@emotion/jest": "^11.13.0", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint/js": "^9.17.0", - "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", - "@types/jest": "^29.5.14", "@types/react-dom": "^18.3.1", "@types/react-test-renderer": "^19.0.0", "@vitejs/plugin-legacy": "^5.4.3", @@ -58,20 +54,15 @@ "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-compat": "^6.0.2", - "eslint-plugin-jest": "^28.10.0", "eslint-plugin-perfectionist": "^4.6.0", "eslint-plugin-prefer-arrow-functions": "^3.4.1", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.3", "globals": "^15.14.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jest-mock": "^29.7.0", "jsdom": "^26.0.0", "npm-run-all": "^4.1.5", "prettier": "^3.4.1", "rimraf": "^6.0.1", - "ts-jest": "^29.2.5", "typescript": "^5.5.4", "typescript-eslint": "^8.19.1", "vite": "^5.4.11",