From 9ee4b4bc24f2eb7f880fc96b31c9d11bf151b71c Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Fri, 26 Jan 2024 09:28:59 +0100 Subject: [PATCH 1/3] test: switch from jest to vitest --- .eslintrc.json | 9 +- .npmrc | 8 - .vscode/settings.json | 5 - __mocks__/axios.js | 2 - __mocks__/file.js | 8 - __mocks__/style.js | 0 package.json | 32 +- packages/design-system/package.json | 9 +- .../__snapshots__/OcAvatarCount.spec.ts.snap | 4 +- .../components/OcAvatars/OcAvatars.spec.ts | 6 +- .../__snapshots__/OcAvatars.spec.ts.snap | 23 +- .../__snapshots__/OcBreadcrumb.spec.ts.snap | 96 +- .../OcDrop/__snapshots__/OcDrop.spec.ts.snap | 8 +- .../src/components/OcIcon/OcIcon.spec.ts | 7 - .../__snapshots__/OcModal.spec.ts.snap | 70 +- .../OcNotificationMessage.spec.ts | 4 +- .../OcPagination/OcPagination.spec.ts | 2 +- .../__snapshots__/OcProgress.spec.ts.snap | 8 +- .../OcStatusIndicators.spec.ts | 4 +- .../src/components/OcTable/OcTable.spec.ts | 14 +- .../OcTag/__snapshots__/OcTag.spec.ts.snap | 8 +- .../OcTextInput/OcTextInput.spec.ts | 10 +- .../__snapshots__/OcTextInput.spec.ts.snap | 58 +- .../__snapshots__/OcTableCell.spec.ts.snap | 4 +- .../composables/useIsVisible/index.spec.ts | 12 +- packages/tsconfig/tsconfig.json | 2 +- .../tests/unit/components/AppTemplate.spec.ts | 8 +- .../components/Groups/ContextActions.spec.ts | 39 +- .../Groups/CreateGroupModal.spec.ts | 12 +- .../unit/components/Groups/GroupsList.spec.ts | 18 +- .../Groups/SideBar/EditPanel.spec.ts | 2 +- .../Groups/SideBar/MembersPanel.spec.ts | 2 +- .../__snapshots__/EditPanel.spec.ts.snap | 25 +- .../__snapshots__/MembersPanel.spec.ts.snap | 24 +- .../components/Spaces/ContextActions.spec.ts | 5 +- .../Spaces/SideBar/ActionsPanel.spec.ts | 13 +- .../Spaces/SideBar/MembersPanel.spec.ts | 2 +- .../Spaces/SideBar/MembersRoleSection.spec.ts | 2 +- .../__snapshots__/MembersPanel.spec.ts.snap | 28 +- .../MembersRoleSection.spec.ts.snap | 16 +- .../unit/components/Spaces/SpacesList.spec.ts | 18 +- .../__snapshots__/SpacesList.spec.ts.snap | 140 +- .../components/Users/AddToGroupsModal.spec.ts | 8 +- .../components/Users/CreateUserModal.spec.ts | 24 +- .../unit/components/Users/GroupSelect.spec.ts | 2 +- .../unit/components/Users/LoginModal.spec.ts | 6 +- .../Users/RemoveFromGroupsModal.spec.ts | 8 +- .../Users/SideBar/EditPanel.spec.ts | 2 +- .../__snapshots__/EditPanel.spec.ts.snap | 28 +- .../unit/components/Users/UsersList.spec.ts | 20 +- .../__snapshots__/GroupSelect.spec.ts.snap | 10 +- .../__snapshots__/LoginModal.spec.ts.snap | 10 +- .../useGeneralActionsResetLogo.spec.ts | 15 +- .../useGeneralActionsUploadLogo.spec.ts | 14 +- .../groups/useGroupActionsDelete.spec.ts | 8 +- .../groups/useGroupActionsEdit.spec.ts | 2 +- .../users/useUserActionsAddToGroups.spec.ts | 2 +- .../users/useUserActionsDelete.spec.ts | 8 +- .../actions/users/useUserActionsEdit.spec.ts | 2 +- .../users/useUserActionsEditLogin.spec.ts | 2 +- .../useUserActionsRemoveFromGroups.spec.ts | 2 +- .../tests/unit/index.spec.ts | 18 +- .../tests/unit/views/Groups.spec.ts | 18 +- .../tests/unit/views/Spaces.spec.ts | 18 +- .../tests/unit/views/Users.spec.ts | 44 +- .../views/__snapshots__/General.spec.ts.snap | 10 +- .../views/__snapshots__/Spaces.spec.ts.snap | 18 +- .../views/__snapshots__/Users.spec.ts.snap | 189 +- .../tests/unit/__snapshots__/app.spec.ts.snap | 34 +- .../web-app-external/tests/unit/app.spec.ts | 24 +- packages/web-app-files/package.json | 1 - .../tests/mocks/useBreadcrumbsFromPathMock.ts | 4 +- .../mocks/useResourcesViewDefaultsMock.ts | 12 +- .../tests/mocks/useScrollToMock.ts | 4 +- .../web-app-files/tests/mocks/useSortMock.ts | 2 +- .../tests/unit/HandleUpload.spec.ts | 20 +- .../components/AppBar/CreateAndUpload.spec.ts | 30 +- .../components/AppBar/CreateSpace.spec.ts | 4 +- .../AppBar/SharesNavigation.spec.ts | 2 +- .../AppBar/Upload/ResourceUpload.spec.ts | 6 +- .../__snapshots__/ResourceUpload.spec.ts.snap | 36 +- .../CreateAndUpload.spec.ts.snap | 152 +- .../__snapshots__/CreateSpace.spec.ts.snap | 12 +- .../SharesNavigation.spec.ts.snap | 63 +- .../EmbedActions/EmbedActions.spec.ts | 18 +- .../FilesList/NotFoundMessage.spec.ts | 2 +- .../components/FilesList/QuickActions.spec.ts | 28 +- .../FilesList/ResourceDetails.spec.ts | 18 +- .../ResourceDetails.spec.ts.snap | 78 +- .../Modals/SetLinkPasswordModal.spec.ts | 2 +- .../tests/unit/components/Search/List.spec.ts | 27 +- .../SideBar/Actions/FileActions.spec.ts | 18 +- .../SideBar/Details/FileDetails.spec.ts | 6 +- .../SideBar/PrivateLinkItem.spec.ts | 8 +- .../InviteCollaboratorForm.spec.ts | 10 +- .../RecipientContainer.spec.ts | 6 +- .../RecipientContainer.spec.ts.snap | 63 +- .../Shares/Collaborators/ListItem.spec.ts | 10 +- .../Shares/Collaborators/RoleDropdown.spec.ts | 12 +- .../__snapshots__/ListItem.spec.ts.snap | 43 +- .../__snapshots__/RoleDropdown.spec.ts.snap | 362 ++- .../SideBar/Shares/FileLinks.spec.ts | 22 +- .../SideBar/Shares/FileShares.spec.ts | 16 +- .../Shares/Links/DetailsAndEdit.spec.ts | 2 +- .../SideBar/Shares/Links/NameAndCopy.spec.ts | 10 +- .../__snapshots__/DetailsAndEdit.spec.ts.snap | 63 +- .../__snapshots__/NameAndCopy.spec.ts.snap | 56 +- .../SideBar/Shares/SpaceMembers.spec.ts | 16 +- .../__snapshots__/FileShares.spec.ts.snap | 60 +- .../__snapshots__/SpaceMembers.spec.ts.snap | 44 +- .../components/SideBar/TagsSelect.spec.ts | 32 +- .../SideBar/Versions/FileVersions.spec.ts | 13 +- .../PrivateLinkItem.spec.ts.snap | 32 +- .../Spaces/SpaceContextActions.spec.ts | 2 +- .../__snapshots__/SpaceHeader.spec.ts.snap | 56 +- .../spaces/useSpaceActionsUploadImage.spec.ts | 6 +- .../helpers/resource/actions/upload.spec.ts | 10 +- .../tests/unit/helpers/textUtils.spec.ts | 1 - .../tests/unit/helpers/ui/filesList.spec.ts | 6 +- .../tests/unit/helpers/user/avatarUrl.spec.ts | 2 +- .../web-app-files/tests/unit/index.spec.ts | 2 +- .../tests/unit/search/sdk.spec.ts | 6 +- .../tests/unit/views/Favorites.spec.ts | 16 +- .../tests/unit/views/FilesDrop.spec.ts | 2 +- .../unit/views/shares/SharedViaLink.spec.ts | 12 +- .../unit/views/shares/SharedWithMe.spec.ts | 30 +- .../views/shares/SharedWithOthers.spec.ts | 18 +- .../unit/views/spaces/DriveRedirect.spec.ts | 2 +- .../unit/views/spaces/DriveResolver.spec.ts | 37 +- .../unit/views/spaces/GenericSpace.spec.ts | 42 +- .../unit/views/spaces/GenericTrash.spec.ts | 12 +- .../tests/unit/views/spaces/Projects.spec.ts | 27 +- .../__snapshots__/Projects.spec.ts.snap | 22 +- .../tests/unit/views/trash/Overview.spec.ts | 2 +- .../trash/__snapshots__/Overview.spec.ts.snap | 61 +- .../tests/unit/extensions.spec.ts | 2 +- .../web-app-preview/tests/unit/app.spec.ts | 20 +- .../unit/components/MediaControls.spec.ts | 2 +- .../web-app-search/src/portals/SearchBar.vue | 12 +- .../tests/unit/portals/SearchBar.spec.ts | 33 +- .../tests/unit/views/List.spec.ts | 18 +- .../tests/unit/__snapshots__/app.spec.ts.snap | 10 +- .../tests/unit/app.spec.ts | 4 +- .../unit/helpers/resource/functions.spec.ts | 2 +- .../unit/helpers/space/functions.spec.ts | 2 +- packages/web-client/tests/unit/sse.spec.ts | 21 +- packages/web-pkg/package.json | 3 +- .../components/FilesList/ResourceTable.vue | 4 +- .../actions/files/useFileActionsSetReadme.ts | 2 - .../composables/piniaStores/shares/shares.ts | 8 +- packages/web-pkg/src/services/archiver.ts | 2 +- .../web-pkg/tests/mocks/useScrollToMock.ts | 4 +- .../tests/unit/components/AppBanner.spec.ts | 4 +- .../unit/components/AppBar/AppBar.spec.ts | 11 +- .../AppBar/__snapshots__/AppBar.spec.ts.snap | 75 +- .../__snapshots__/ErrorScreen.spec.ts.snap | 10 +- .../__snapshots__/LoadingScreen.spec.ts.snap | 10 +- .../tests/unit/components/AppTopBar.spec.ts | 2 +- .../unit/components/BatchActions.spec.ts | 2 +- .../ContextActions/ActionMenuItem.spec.ts | 2 +- .../ContextActionMenu.spec.ts.snap | 12 +- .../ContextMenuQuickAction.spec.ts.snap | 13 +- .../unit/components/CreateLinkModal.spec.ts | 44 +- .../components/CreateShortcutModal.spec.ts | 6 +- .../FilesList/ContextActions.spec.ts | 21 +- .../FilesList/ResourceListItem.spec.ts | 15 +- .../FilesList/ResourceTable.spec.ts | 51 +- .../FilesList/ResourceTiles.spec.ts | 14 +- .../__snapshots__/ResourceIcon.spec.ts.snap | 72 +- .../ResourceListItem.spec.ts.snap | 34 +- .../__snapshots__/ResourceName.spec.ts.snap | 58 +- .../__snapshots__/ResourceTile.spec.ts.snap | 30 +- .../__snapshots__/ResourceTiles.spec.ts.snap | 50 +- .../Filters/ItemFilterInline.spec.ts | 10 +- .../tests/unit/components/ItemFilter.spec.ts | 4 +- .../unit/components/ItemFilterToggle.spec.ts | 8 +- .../unit/components/LinkRoleDropdown.spec.ts | 2 +- .../unit/components/LoadingIndicator.spec.ts | 2 +- .../Modals/ResourceConflictModal.spec.ts | 10 +- .../tests/unit/components/Pagination.spec.ts | 2 +- .../tests/unit/components/QuotaSelect.spec.ts | 2 - .../components/Search/ResourcePreview.spec.ts | 16 +- .../ResourcePreview.spec.ts.snap | 4 +- .../unit/components/SearchBarFilter.spec.ts | 6 +- .../unit/components/Spaces/QuotaModal.spec.ts | 4 +- .../Spaces/ReadmeContentModal.spec.ts | 6 +- .../tests/unit/components/ViewOptions.spec.ts | 18 +- .../__snapshots__/AppTopBar.spec.ts.snap | 80 +- .../__snapshots__/ItemFilter.spec.ts.snap | 62 +- .../__snapshots__/SpaceQuota.spec.ts.snap | 10 +- .../sidebar/CompareSaveDialog.spec.ts | 2 - .../components/sidebar/FileSideBar.spec.ts | 6 +- .../components/sidebar/Files/FileInfo.spec.ts | 2 +- .../__snapshots__/SpaceDetails.spec.ts.snap | 67 +- .../SpaceDetailsMultiple.spec.ts.snap | 54 +- .../__snapshots__/SpaceInfo.spec.ts.snap | 13 +- .../files/useFileActionsAcceptShare.spec.ts | 2 +- .../actions/files/useFileActionsCopy.spec.ts | 2 +- .../files/useFileActionsCopyQuicklink.spec.ts | 30 +- .../files/useFileActionsCreateLink.spec.ts | 22 +- .../files/useFileActionsCreateNewFile.spec.ts | 17 +- .../useFileActionsCreateNewFolder.spec.ts | 10 +- .../useFileActionsCreateNewShortcut.spec.ts | 2 +- .../files/useFileActionsDelete.spec.ts | 15 +- .../useFileActionsDownloadArchive.spec.ts | 11 +- .../files/useFileActionsEmptyTrashBin.spec.ts | 4 +- .../actions/files/useFileActionsMove.spec.ts | 2 +- .../files/useFileActionsOpenShortcut.spec.ts | 18 +- .../files/useFileActionsRename.spec.ts | 16 +- .../files/useFileActionsRestore.spec.ts | 15 +- .../files/useFileActionsSetImage.spec.ts | 6 +- .../files/useFileActionsSetReadme.spec.ts | 18 +- .../files/useFileActionsShowDetails.spec.ts | 2 +- .../useFileActionsDeleteResources.spec.ts | 4 +- .../spaces/useSpaceActionsDelete.spec.ts | 4 +- .../spaces/useSpaceActionsDisable.spec.ts | 4 +- .../spaces/useSpaceActionsDuplicate.spec.ts | 4 +- .../useSpaceActionsEditDescription.spec.ts | 4 +- .../spaces/useSpaceActionsEditQuota.spec.ts | 2 +- .../useSpaceActionsEditReadmeContent.spec.ts | 2 +- .../useSpaceActionsNavigateToTrash.spec.ts | 2 +- .../spaces/useSpaceActionsRename.spec.ts | 4 +- .../spaces/useSpaceActionsRestore.spec.ts | 4 +- .../actions/useOpenWithDefaultApp.spec.ts | 12 +- .../useBreadcrumbsFromPath.spec.ts | 2 +- .../driveResolver/useDriveResolver.spec.ts | 2 +- .../embedMode/useEmbedMode.spec.ts | 4 +- .../fileListHeaderPosition/spec/index.ts | 2 +- .../useFileListHeaderPosition.spec.ts | 2 +- .../folderLink/useFolderLink.spec.ts | 2 +- .../composables/piniaStores/cofig.spec.ts | 4 +- .../composables/piniaStores/shares.spec.ts | 12 +- .../composables/piniaStores/spaces.spec.ts | 2 +- .../unit/composables/router/useRouter.spec.ts | 2 - .../composables/scrollTo/useScrollTo.spec.ts | 44 +- .../unit/composables/search/useSearch.spec.ts | 2 +- .../spaces/useGetMatchingSpace.spec.ts | 2 +- .../tests/unit/helpers/cache/cache.spec.ts | 18 +- .../unit/helpers/contextMenuDropdown.spec.ts | 28 +- .../tests/unit/helpers/datetime.spec.ts | 5 +- .../conflictHandling/conflictDialog.spec.ts | 14 +- .../resourcesTransfer.spec.ts | 20 +- .../tests/unit/helpers/share/link.spec.ts | 4 +- .../helpers/share/triggerShareAction.spec.ts | 8 +- .../web-pkg/tests/unit/http/client.spec.ts | 32 +- .../tests/unit/observer/visibility.spec.ts | 28 +- .../web-pkg/tests/unit/router/utils.spec.ts | 2 +- .../tests/unit/services/archiver.spec.ts | 7 +- .../tests/unit/services/client.spec.ts | 32 +- .../tests/unit/services/eventBus.spec.ts | 4 +- .../unit/services/loadingService.spec.ts | 8 +- .../unit/services/previewService.spec.ts | 6 +- packages/web-runtime/package.json | 1 - .../components/Account/GdprExport.spec.ts | 10 +- .../tests/unit/components/Avatar.spec.ts | 10 +- .../unit/components/EditPasswordModal.spec.ts | 4 +- .../tests/unit/components/MobileNav.spec.ts | 2 +- .../unit/components/ModalWrapper.spec.ts | 18 +- .../components/SidebarNav/SidebarNav.spec.ts | 2 +- .../__snapshots__/SidebarNav.spec.ts.snap | 25 +- .../__snapshots__/SidebarNavItem.spec.ts.snap | 18 +- .../tests/unit/components/SkipTo.spec.ts | 12 +- .../Topbar/ApplicationsMenu.spec.ts | 8 +- .../components/Topbar/FeedbackLink.spec.ts | 18 +- .../components/Topbar/Notifications.spec.ts | 19 +- .../components/Topbar/SidebarToggle.spec.ts | 2 +- .../components/Topbar/ThemeSwitcher.spec.ts | 2 +- .../unit/components/Topbar/TopBar.spec.ts | 8 +- .../unit/components/Topbar/UserMenu.spec.ts | 2 +- .../ApplicationsMenu.spec.ts.snap | 32 +- .../__snapshots__/FeedbackLink.spec.ts.snap | 13 - .../NotificationBell.spec.ts.snap | 10 +- .../__snapshots__/SidebarToggle.spec.ts.snap | 20 +- .../__snapshots__/ThemeSwitcher.spec.ts.snap | 18 +- .../__snapshots__/UserMenu.spec.ts.snap | 468 ++-- .../tests/unit/container/bootstrap.spec.ts | 38 +- .../tests/unit/helpers/theme.spec.ts | 26 +- .../__snapshots__/accessDenied.spec.ts.snap | 14 +- .../pages/__snapshots__/account.spec.ts.snap | 82 +- .../resolvePublicLink.spec.ts.snap | 22 +- .../tests/unit/pages/account.spec.ts | 8 +- .../tests/unit/pages/oidcCallback.spec.ts | 36 +- .../unit/pages/resolvePrivateLink.spec.ts | 20 +- .../unit/pages/resolvePublicLink.spec.ts | 6 +- .../tests/unit/router/index.spec.ts | 5 +- .../unit/services/auth/authService.spec.ts | 69 +- packages/web-test-helpers/src/helpers.ts | 6 +- packages/web-test-helpers/src/mocks/axios.ts | 6 +- .../src/mocks/defaultComponentMocks.ts | 2 +- packages/web-test-helpers/src/mocks/pinia.ts | 2 +- .../src/mocks/useAppDefaultsMock.ts | 22 +- .../src/mocks/useExtensionRegistryMock.ts | 2 +- .../src/mocks/useGetMatchingSpaceMock.ts | 2 +- pnpm-lock.yaml | 2040 +++-------------- tests/unit/config/jest.config.ts | 75 - tests/unit/config/jest.init.ts | 13 - tests/unit/config/jest.overrides.ts | 20 - tests/unit/config/vitest.config.ts | 50 + tests/unit/config/vitest.init.ts | 13 + vite.config.common.ts | 2 - 300 files changed, 2990 insertions(+), 5036 deletions(-) delete mode 100644 __mocks__/axios.js delete mode 100644 __mocks__/file.js delete mode 100644 __mocks__/style.js delete mode 100644 packages/web-runtime/tests/unit/components/Topbar/__snapshots__/FeedbackLink.spec.ts.snap delete mode 100644 tests/unit/config/jest.config.ts delete mode 100644 tests/unit/config/jest.init.ts delete mode 100644 tests/unit/config/jest.overrides.ts create mode 100644 tests/unit/config/vitest.config.ts create mode 100644 tests/unit/config/vitest.init.ts diff --git a/.eslintrc.json b/.eslintrc.json index fb1467389f3..811dc59a70c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,5 @@ { "extends": [ - "@ownclouders", - "plugin:jest/recommended" - ], - "plugins": ["jest"], - "rules": { - "jest/no-standalone-expect": "off" - } + "@ownclouders" + ] } diff --git a/.npmrc b/.npmrc index f7cbfafc970..a70c048c334 100644 --- a/.npmrc +++ b/.npmrc @@ -4,14 +4,6 @@ shared-workspace-lockfile=true # apps public-hoist-pattern[]=owncloud-sdk -# esm modules (so we can easily transpile them via jest config) -public-hoist-pattern[]=lodash-es -public-hoist-pattern[]=mark.js -public-hoist-pattern[]=fuse.js -public-hoist-pattern[]=filesize -public-hoist-pattern[]=layerr -public-hoist-pattern[]=webdav - # @vue/component-compiler-utils hoist-pattern[]=sass diff --git a/.vscode/settings.json b/.vscode/settings.json index 0634917af75..0cf114595a5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,11 +13,6 @@ }, "editor.formatOnSave": true, "eslint.format.enable": true, - "jest.autoRun": { - "watch": false, - "onStartup": true - }, - "jest.jestCommandLine": "pnpm test:unit", "npm.packageManager": "pnpm", "typescript.format.enable": false, "editor.quickSuggestions": { diff --git a/__mocks__/axios.js b/__mocks__/axios.js deleted file mode 100644 index ef28bf2ceee..00000000000 --- a/__mocks__/axios.js +++ /dev/null @@ -1,2 +0,0 @@ -import mockAxios from 'jest-mock-axios' -export default mockAxios diff --git a/__mocks__/file.js b/__mocks__/file.js deleted file mode 100644 index 578f42d4a55..00000000000 --- a/__mocks__/file.js +++ /dev/null @@ -1,8 +0,0 @@ -// fileTransformer.js -const path = require('path') - -module.exports = { - process(src, filename) { - return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';' - } -} diff --git a/__mocks__/style.js b/__mocks__/style.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/package.json b/package.json index 6978cff125e..c65eb7c34a0 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint": "eslint vite.config.ts '{packages,tests}/**/*.{js,ts,vue}' --color", "serve": "SERVER=true pnpm build:w", "test:e2e:cucumber": "NODE_TLS_REJECT_UNAUTHORIZED=0 TS_NODE_PROJECT=./tests/e2e/cucumber/tsconfig.json cucumber-js --profile=e2e -f json:tests/e2e/cucumber/report/cucumber_report.json", - "test:unit": "NODE_OPTIONS=--unhandled-rejections=throw jest --config ./tests/unit/config/jest.config.ts", + "test:unit": "NODE_OPTIONS=--unhandled-rejections=throw TZ=UTC vitest --config ./tests/unit/config/vitest.config.ts", "licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages '@ownclouders/babel-preset;@ownclouders/eslint-config;@ownclouders/prettier-config;@ownclouders/tsconfig;@ownclouders/web-client;@ownclouders/web-pkg;draw-io;external;web-app-files;text-editor;preview;web-app-ocm;@ownclouders/design-system;pdf-viewer;web-app-search;admin-settings;webfinger;web-runtime'", "licenses:csv": "license-checker-rseidelsohn --relativeLicensePath --csv --out ./third-party-licenses/third-party-licenses.csv", "licenses:save": "license-checker-rseidelsohn --relativeLicensePath --out /dev/null --files ./third-party-licenses/third-party-licenses", @@ -63,16 +63,12 @@ "@ownclouders/tsconfig": "workspace:*", "@playwright/test": "1.39.0", "@rollup/plugin-inject": "5.0.3", - "@types/jest": "29.5.1", - "@types/jest-axe": "3.5.9", "@types/lodash-es": "4.17.7", "@types/node": "16.18.30", "@types/node-fetch": "2.6.10", - "@vitejs/plugin-vue": "4.6.2", + "@vitejs/plugin-vue": "5.0.3", "@vue/test-utils": "v2.4.0-alpha.0", - "@vue/vue3-jest": "29.2.4", "autoprefixer": "10.4.16", - "babel-jest": "29.5.0", "browserslist-to-esbuild": "^1.2.0", "browserslist-useragent-regexp": "^4.0.0", "commander": "11.1.0", @@ -81,15 +77,8 @@ "cucumber-html-reporter": "7.1.1", "ejs": "3.1.9", "eslint": "8.56.0", - "eslint-plugin-jest": "^27.6.1", "flush-promises": "1.0.2", "git-repo-info": "2.1.1", - "jest": "29.7.0", - "jest-axe": "8.0.0", - "jest-environment-jsdom": "29.7.0", - "jest-mock-axios": "4.7.3", - "jest-mock-extended": "3.0.5", - "jest-serializer-vue-tjw": "^3.19.0", "join-path": "1.1.1", "jsdom": "^20.0.2", "license-checker-rseidelsohn": "3.3.0", @@ -104,12 +93,14 @@ "rollup-plugin-node-polyfills": "0.2.1", "rollup-plugin-visualizer": "5.9.0", "sass": "1.69.7", - "ts-jest": "29.1.1", "ts-node": "10.9.2", "tslib": "2.5.0", "typescript": "5.3.3", "url-search-params-polyfill": "8.1.1", "vite": "5.0.12", + "vitest": "1.2.1", + "vitest-mock-extended": "1.3.1", + "@vitest/coverage-v8": "1.2.1", "vite-plugin-environment": "^1.1.3", "vue-tsc": "1.8.10", "vue3-gettext": "2.4.0", @@ -139,19 +130,6 @@ "@uppy/utils": "https://github.com/owncloud/uppy/releases/download/v3.12.13-owncloud/uppy-utils.tgz", "@uppy/webdav": "https://github.com/owncloud/uppy/releases/download/v3.12.13-owncloud/uppy-webdav.tgz", "@uppy/xhr-upload": "https://github.com/owncloud/uppy/releases/download/v3.12.13-owncloud/uppy-xhr-upload.tgz" - }, - "packageExtensions": { - "jest-serializer-vue-tjw": { - "dependencies": { - "@vue/compiler-sfc": "2.7.14" - } - } - }, - "patchedDependencies": { - "jest-serializer-vue-tjw@3.19.0": "patches/jest-serializer-vue-tjw@3.19.0.patch" } - }, - "jestSerializer": { - "sortAttributes": true } } diff --git a/packages/design-system/package.json b/packages/design-system/package.json index d48317f25c3..ecbcc738e85 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -28,9 +28,7 @@ "styleguide": "vue-styleguidist server --open --config ./config/docs.config.js", "styleguide:build": "vue-styleguidist build --config ./config/docs.config.js", "tokens": "node build/build-tokens.js", - "tokens:w": "onchange -i \"./src/tokens/**/*.json\" -- npm run tokens", - "test": "jest --config ./jest.conf.js --coverage", - "test:e2e": "playwright test --config ./tests/e2e/playwright.config.ts" + "tokens:w": "onchange -i \"./src/tokens/**/*.json\" -- npm run tokens" }, "browserslist": [ "> 1%", @@ -54,7 +52,6 @@ "@popperjs/core": "^2.11.5", "autoprefixer": "10.4.16", "babel-core": "7.0.0-bridge.0", - "babel-jest": "29.5.0", "babel-loader": "^9.0.0", "babel-plugin-require-context-hook": "^1.0.0", "chalk": "^4.1.2", @@ -69,10 +66,8 @@ "fuse.js": "6.6.2", "glob": "^10.0.0", "html-loader": "^1.3.2", - "jest": "^29.7.0", "jest-axe": "8.0.0", - "jest-environment-jsdom": "29.7.0", - "jest-serializer-vue-tjw": "^3.19.0", + "lodash-es": "4.17.21", "luxon": "3.2.1", "mini-css-extract-plugin": "^1.3.1", "node-notifier": "^10.0.0", diff --git a/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap b/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap index d049b6ccd3e..629e0d2e9ad 100644 --- a/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap +++ b/packages/design-system/src/components/OcAvatarCount/__snapshots__/OcAvatarCount.spec.ts.snap @@ -1,3 +1,3 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`OcAvatarCount dynamically calculates font size 1`] = `+2`; +exports[`OcAvatarCount > dynamically calculates font size 1`] = `"+2"`; diff --git a/packages/design-system/src/components/OcAvatars/OcAvatars.spec.ts b/packages/design-system/src/components/OcAvatars/OcAvatars.spec.ts index 2dcf4884b85..8c658cd3492 100644 --- a/packages/design-system/src/components/OcAvatars/OcAvatars.spec.ts +++ b/packages/design-system/src/components/OcAvatars/OcAvatars.spec.ts @@ -40,7 +40,7 @@ const items = [ describe('OcAvatars', () => { it('displays tooltip', () => { - const OcTooltip = jest.fn() + const OcTooltip = vi.fn() const wrapper = shallowMount(Avatars, { props: { items, @@ -60,7 +60,7 @@ describe('OcAvatars', () => { }) it('prefers avatars over links when maxDisplayed is exceeded', () => { - const OcTooltip = jest.fn() + const OcTooltip = vi.fn() const wrapper = shallowMount(Avatars, { props: { items, @@ -82,7 +82,7 @@ describe('OcAvatars', () => { }) it('shows avatars first and links last', () => { - const OcTooltip = jest.fn() + const OcTooltip = vi.fn() const wrapper = shallowMount(Avatars, { props: { items, diff --git a/packages/design-system/src/components/OcAvatars/__snapshots__/OcAvatars.spec.ts.snap b/packages/design-system/src/components/OcAvatars/__snapshots__/OcAvatars.spec.ts.snap index b97ab61ffb9..65341247abc 100644 --- a/packages/design-system/src/components/OcAvatars/__snapshots__/OcAvatars.spec.ts.snap +++ b/packages/design-system/src/components/OcAvatars/__snapshots__/OcAvatars.spec.ts.snap @@ -1,22 +1,7 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`OcAvatars displays tooltip 1`] = ` - - - List of users - -`; +exports[`OcAvatars > displays tooltip 1`] = `" List of users"`; -exports[`OcAvatars prefers avatars over links when maxDisplayed is exceeded 1`] = ` - - - List of users - -`; +exports[`OcAvatars > prefers avatars over links when maxDisplayed is exceeded 1`] = `" List of users"`; -exports[`OcAvatars shows avatars first and links last 1`] = ` - - - List of users - -`; +exports[`OcAvatars > shows avatars first and links last 1`] = `" List of users"`; diff --git a/packages/design-system/src/components/OcBreadcrumb/__snapshots__/OcBreadcrumb.spec.ts.snap b/packages/design-system/src/components/OcBreadcrumb/__snapshots__/OcBreadcrumb.spec.ts.snap index 4e9bc5e802a..4375cdb8f01 100644 --- a/packages/design-system/src/components/OcBreadcrumb/__snapshots__/OcBreadcrumb.spec.ts.snap +++ b/packages/design-system/src/components/OcBreadcrumb/__snapshots__/OcBreadcrumb.spec.ts.snap @@ -1,95 +1,73 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`OcBreadcrumb displays all items 1`] = ` -