From 4f6609a072c3801b8495f11dc9f43fd2faa50383 Mon Sep 17 00:00:00 2001 From: Juan Picado Date: Sat, 7 Dec 2024 21:48:32 +0100 Subject: [PATCH] final migration to vitest remove jest (#4978) * migrate vitest ui-components * migrate vitest ui-components * fix e2e * cleanup --- e2e/cli/e2e-yarn2/info.spec.ts | 2 +- e2e/cli/e2e-yarn3/info.spec.ts | 2 +- e2e/cli/e2e-yarn4/info.spec.ts | 2 +- .../plugins/ui-theme/jest/api/packages.json | 42 - packages/plugins/ui-theme/jest/jest.config.js | 40 - .../plugins/ui-theme/jest/jestEnvironment.js | 1 - .../plugins/ui-theme/jest/server-handlers.ts | 27 - packages/plugins/ui-theme/jest/setup-env.ts | 17 - .../jest/unit/components/store/login.ts | 24 - .../jest/unit/components/store/logo.ts | 7 - .../jest/unit/components/store/package.ts | 174 ---- .../jest/unit/components/store/packageMeta.ts | 590 ------------ packages/plugins/ui-theme/package.json | 17 +- .../plugins/ui-theme/src/App/App.test.tsx | 5 +- .../ui-theme/src/__mocks__/react-markdown.tsx | 8 - .../ui-theme/src/__mocks__/remark-plugin.ts | 1 - packages/plugins/ui-theme/vitest.config.ts | 35 + .../{jest/setup.ts => vitest.setup.ts} | 11 +- .../jest => plugins/ui-theme/vitest}/setup.ts | 13 +- packages/ui-components/.babelrc | 10 +- packages/ui-components/CHANGELOG.md | 278 ------ packages/ui-components/jest/identity.js | 29 - packages/ui-components/jest/jest.config.js | 43 - .../ui-components/jest/jestEnvironment.js | 1 - packages/ui-components/jest/server.ts | 6 - packages/ui-components/jest/setup-env.ts | 14 - .../ui-components/jest/unit/empty-string.ts | 1 - packages/ui-components/jest/unit/empty.ts | 1 - packages/ui-components/package.json | 19 +- .../src/AppTest/AppRoute.test.tsx | 9 +- packages/ui-components/src/Theme/index.ts | 2 +- .../src/__mocks__/react-markdown.tsx | 8 - .../src/__mocks__/remark-plugin.ts | 1 - .../src/components/Author/Author.test.tsx | 3 +- .../Author/__snapshots__/Author.test.tsx.snap | 574 +---------- .../CopyClipboard/CopyToClipBoard.test.tsx | 3 +- .../Dependencies/Dependencies.test.tsx | 7 + .../Dependencies/DependencyBlock.test.tsx | 5 +- .../__snapshots__/Developers.test.tsx.snap | 474 +-------- .../src/components/Engines/Engines.test.tsx | 5 +- .../ErrorBoundary/ErrorBoundary.test.tsx | 3 +- .../components/Forbidden/Forbidden.test.tsx | 5 +- .../HeaderInfoDialog.test.tsx | 3 +- .../Label/__snapshots__/Label.test.tsx.snap | 11 +- .../Link/__snapshots__/Link.test.tsx.snap | 52 +- .../__snapshots__/LinkExternal.test.tsx.snap | 42 +- .../__snapshots__/Spinner.test.tsx.snap | 162 +--- .../LoginDialog/LoginDialog.test.tsx | 15 +- .../__snapshots__/LoginDialog.test.tsx.snap | 4 +- .../Logo/__snapshots__/Logo.test.tsx.snap | 20 +- .../__snapshots__/Noitems.test.tsx.snap | 82 +- .../src/components/NotFound/Notfound.test.tsx | 5 +- .../PackageList/Packagelist.test.tsx | 3 +- .../Readme/__snapshots__/Readme.spec.tsx.snap | 90 +- .../__snapshots__/Repository.test.tsx.snap | 4 +- .../src/components/Search/Search.test.tsx | 17 +- .../__snapshots__/TextField.test.tsx.snap | 218 +---- .../__snapshots__/UpLinks.test.tsx.snap | 528 +--------- .../src/components/Versions/Versions.test.tsx | 16 +- .../TranslatorProvider.spec.tsx | 3 +- .../VersionProvider/VersionProvider.tsx | 7 +- .../Detail/__snapshots__/Detail.test.tsx.snap | 184 +--- .../src/sections/Home/Home.test.tsx | 10 +- .../src/sections/SideBar/Sidebar.test.tsx | 15 +- .../src/sections/SideBar/Sidebar.tsx | 1 + packages/ui-components/src/store/api.test.ts | 14 +- .../src/store/models/login.test.ts | 44 +- .../src/test/test-react-testing-library.tsx | 8 +- .../ui-components/src/utils/cli-utils.test.ts | 19 +- .../ui-components/src/utils/token.test.ts | 8 +- packages/ui-components/tsconfig.build.json | 2 +- packages/ui-components/vitest.config.ts | 39 + packages/ui-components/vitest.setup.ts | 46 + .../{jest => vitest}/api/glob-sidebar.json | 0 .../{jest => vitest}/api/got-sidebar.json | 0 .../{jest => vitest}/api/home-packages.json | 0 .../{jest => vitest}/api/jquery-readme.js | 0 .../{jest => vitest}/api/jquery-sidebar.json | 0 .../api/search-verdaccio.json | 0 .../{jest => vitest}/api/storybook-readme.js | 0 .../api/storybook-sidebar.json | 0 .../{jest => vitest}/api/storybook-v.json | 0 .../jest => ui-components/vitest}/identity.js | 0 .../ui-components/vitest/react-markdown.tsx | 7 + .../{jest => vitest}/server-handlers.ts | 0 .../jest => ui-components/vitest}/server.ts | 0 packages/ui-components/vitest/setup-env.ts | 33 + packages/ui-components/vitest/setup.ts | 40 + .../unit/components/__mocks__/token.ts | 0 .../vitest}/unit/empty-string.ts | 0 .../vitest}/unit/empty.ts | 0 .../ui-components/vitest/vitestSerializer.ts | 31 + pnpm-lock.yaml | 906 ++++++++++++------ 93 files changed, 1210 insertions(+), 3998 deletions(-) delete mode 100644 packages/plugins/ui-theme/jest/api/packages.json delete mode 100644 packages/plugins/ui-theme/jest/jest.config.js delete mode 100644 packages/plugins/ui-theme/jest/jestEnvironment.js delete mode 100644 packages/plugins/ui-theme/jest/server-handlers.ts delete mode 100644 packages/plugins/ui-theme/jest/setup-env.ts delete mode 100644 packages/plugins/ui-theme/jest/unit/components/store/login.ts delete mode 100644 packages/plugins/ui-theme/jest/unit/components/store/logo.ts delete mode 100644 packages/plugins/ui-theme/jest/unit/components/store/package.ts delete mode 100644 packages/plugins/ui-theme/jest/unit/components/store/packageMeta.ts delete mode 100644 packages/plugins/ui-theme/src/__mocks__/react-markdown.tsx delete mode 100644 packages/plugins/ui-theme/src/__mocks__/remark-plugin.ts create mode 100644 packages/plugins/ui-theme/vitest.config.ts rename packages/plugins/ui-theme/{jest/setup.ts => vitest.setup.ts} (79%) rename packages/{ui-components/jest => plugins/ui-theme/vitest}/setup.ts (70%) delete mode 100644 packages/ui-components/CHANGELOG.md delete mode 100644 packages/ui-components/jest/identity.js delete mode 100644 packages/ui-components/jest/jest.config.js delete mode 100644 packages/ui-components/jest/jestEnvironment.js delete mode 100644 packages/ui-components/jest/server.ts delete mode 100644 packages/ui-components/jest/setup-env.ts delete mode 100644 packages/ui-components/jest/unit/empty-string.ts delete mode 100644 packages/ui-components/jest/unit/empty.ts delete mode 100644 packages/ui-components/src/__mocks__/react-markdown.tsx delete mode 100644 packages/ui-components/src/__mocks__/remark-plugin.ts create mode 100644 packages/ui-components/vitest.config.ts create mode 100644 packages/ui-components/vitest.setup.ts rename packages/ui-components/{jest => vitest}/api/glob-sidebar.json (100%) rename packages/ui-components/{jest => vitest}/api/got-sidebar.json (100%) rename packages/ui-components/{jest => vitest}/api/home-packages.json (100%) rename packages/ui-components/{jest => vitest}/api/jquery-readme.js (100%) rename packages/ui-components/{jest => vitest}/api/jquery-sidebar.json (100%) rename packages/ui-components/{jest => vitest}/api/search-verdaccio.json (100%) rename packages/ui-components/{jest => vitest}/api/storybook-readme.js (100%) rename packages/ui-components/{jest => vitest}/api/storybook-sidebar.json (100%) rename packages/ui-components/{jest => vitest}/api/storybook-v.json (100%) rename packages/{plugins/ui-theme/jest => ui-components/vitest}/identity.js (100%) create mode 100644 packages/ui-components/vitest/react-markdown.tsx rename packages/ui-components/{jest => vitest}/server-handlers.ts (100%) rename packages/{plugins/ui-theme/jest => ui-components/vitest}/server.ts (100%) create mode 100644 packages/ui-components/vitest/setup-env.ts create mode 100644 packages/ui-components/vitest/setup.ts rename packages/ui-components/{jest => vitest}/unit/components/__mocks__/token.ts (100%) rename packages/{plugins/ui-theme/jest => ui-components/vitest}/unit/empty-string.ts (100%) rename packages/{plugins/ui-theme/jest => ui-components/vitest}/unit/empty.ts (100%) create mode 100644 packages/ui-components/vitest/vitestSerializer.ts diff --git a/e2e/cli/e2e-yarn2/info.spec.ts b/e2e/cli/e2e-yarn2/info.spec.ts index 700aa89fe..f9f25ccdc 100644 --- a/e2e/cli/e2e-yarn2/info.spec.ts +++ b/e2e/cli/e2e-yarn2/info.spec.ts @@ -30,7 +30,7 @@ describe('install a package', () => { const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json'); const parsedBody = JSON.parse(resp.stdout as string); expect(parsedBody.name).toEqual('react'); - expect(parsedBody.dependencies).toBeDefined(); + expect(parsedBody.versions).toBeDefined(); }); afterAll(async () => { diff --git a/e2e/cli/e2e-yarn3/info.spec.ts b/e2e/cli/e2e-yarn3/info.spec.ts index 700aa89fe..f9f25ccdc 100644 --- a/e2e/cli/e2e-yarn3/info.spec.ts +++ b/e2e/cli/e2e-yarn3/info.spec.ts @@ -30,7 +30,7 @@ describe('install a package', () => { const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json'); const parsedBody = JSON.parse(resp.stdout as string); expect(parsedBody.name).toEqual('react'); - expect(parsedBody.dependencies).toBeDefined(); + expect(parsedBody.versions).toBeDefined(); }); afterAll(async () => { diff --git a/e2e/cli/e2e-yarn4/info.spec.ts b/e2e/cli/e2e-yarn4/info.spec.ts index 700aa89fe..f9f25ccdc 100644 --- a/e2e/cli/e2e-yarn4/info.spec.ts +++ b/e2e/cli/e2e-yarn4/info.spec.ts @@ -30,7 +30,7 @@ describe('install a package', () => { const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json'); const parsedBody = JSON.parse(resp.stdout as string); expect(parsedBody.name).toEqual('react'); - expect(parsedBody.dependencies).toBeDefined(); + expect(parsedBody.versions).toBeDefined(); }); afterAll(async () => { diff --git a/packages/plugins/ui-theme/jest/api/packages.json b/packages/plugins/ui-theme/jest/api/packages.json deleted file mode 100644 index f79a5a192..000000000 --- a/packages/plugins/ui-theme/jest/api/packages.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "name": "test", - "version": "1.0.22", - "description": "test", - "main": "src/index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "http", - "url": "git+https://github.com/test/test.git" - }, - "keywords": [], - "author": { - "name": "", - "email": "", - "url": "", - "avatar": "data:image/svg+xml;utf8,%3Csvg%20height%3D%22100%22%20viewBox%3D%22-27%2024%20100%20100%22%20width%3D%22100%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3Ccircle%20cx%3D%2223%22%20cy%3D%2274%22%20id%3D%22a%22%20r%3D%2250%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23F5EEE5%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3CclipPath%20id%3D%22b%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3C%2FclipPath%3E%3Cg%20clip-path%3D%22url(%23b)%22%3E%3Cdefs%3E%3Cpath%20d%3D%22M36%2095.9c0%204%204.7%205.2%207.1%205.8%207.6%202%2022.8%205.9%2022.8%205.9%203.2%201.1%205.7%203.5%207.1%206.6v9.8H-27v-9.8c1.3-3.1%203.9-5.5%207.1-6.6%200%200%2015.2-3.9%2022.8-5.9%202.4-.6%207.1-1.8%207.1-5.8V85h26v10.9z%22%20id%3D%22c%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23E6C19C%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3CclipPath%20id%3D%22d%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3C%2FclipPath%3E%3Cpath%20clip-path%3D%22url(%23d)%22%20d%3D%22M23.2%2035h.2c3.3%200%208.2.2%2011.4%202%203.3%201.9%207.3%205.6%208.5%2012.1%202.4%2013.7-2.1%2035.4-6.3%2042.4-4%206.7-9.8%209.2-13.5%209.4H23h-.1c-3.7-.2-9.5-2.7-13.5-9.4-4.2-7-8.7-28.7-6.3-42.4%201.2-6.5%205.2-10.2%208.5-12.1%203.2-1.8%208.1-2%2011.4-2h.2z%22%20fill%3D%22%23D4B08C%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M22.6%2040c19.1%200%2020.7%2013.8%2020.8%2015.1%201.1%2011.9-3%2028.1-6.8%2033.7-4%205.9-9.8%208.1-13.5%208.3h-.5c-3.8-.3-9.6-2.5-13.6-8.4-3.8-5.6-7.9-21.8-6.8-33.8C2.3%2053.7%203.5%2040%2022.6%2040z%22%20fill%3D%22%23F2CEA5%22%2F%3E%3C%2Fsvg%3E" - }, - "license": "ISC", - "dependencies": { - "lodash": "^4.17.21" - }, - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/test/test/issues" - }, - "homepage": "https://github.com/test/test#readme", - "_id": "test@1.0.22", - "_nodeVersion": "14.17.4", - "_npmVersion": "7.20.5", - "dist": { - "integrity": "sha512-2IDD0lLzGUL7YJ+17Oh9VtbOwdKLqBLS+ZFATDXi5R22TL2hZ9LBFE10bzsDovNc4xtgwZAk1/K+5LHTye4ztg==", - "shasum": "c9152f57636bce762ccb5a83113c42a5831579bc", - "tarball": "http://localhost:4873/test/-/test-1.0.22.tgz" - }, - "contributors": [], - "time": "2021-08-14T20:15:19.336Z", - "users": {} - } -] diff --git a/packages/plugins/ui-theme/jest/jest.config.js b/packages/plugins/ui-theme/jest/jest.config.js deleted file mode 100644 index 923c94aa9..000000000 --- a/packages/plugins/ui-theme/jest/jest.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const config = require('../../../../jest/config'); - -module.exports = Object.assign({}, config, { - automock: false, - collectCoverage: false, - testEnvironment: 'jest-environment-jsdom-global', - transform: { - '^.+\\.(js|ts|tsx)$': 'babel-jest', - }, - moduleFileExtensions: ['js', 'ts', 'tsx'], - testEnvironmentOptions: { - url: 'http://localhost:9000/', - }, - rootDir: '..', - setupFilesAfterEnv: ['/jest/setup-env.ts'], - setupFiles: ['/jest/setup.ts'], - transformIgnorePatterns: ['/node_modules/(?!react-syntax-highlighter)'], - modulePathIgnorePatterns: [ - '/coverage', - '/scripts', - '/.circleci', - '/tools', - '/build', - '/.vscode/', - '/test/e2e/', - ], - snapshotSerializers: ['@emotion/jest/serializer'], - moduleNameMapper: { - '\\.(s?css)$': '/jest/identity.js', - '\\.(png)$': '/jest/identity.js', - '\\.(svg)$': '/jest/unit/empty.ts', - '\\.(jpg)$': '/jest/unit/empty.ts', - '\\.(md)$': '/jest/unit/empty-string.ts', - // note: this section has to be on sync with webpack configuration - 'verdaccio-ui/components/(.*)': '/src/components/$1', - 'verdaccio-ui/utils/(.*)': '/src/utils/$1', - 'react-markdown': '/src/__mocks__/react-markdown.tsx', - 'remark-*': '/src/__mocks__/remark-plugin.ts', - }, -}); diff --git a/packages/plugins/ui-theme/jest/jestEnvironment.js b/packages/plugins/ui-theme/jest/jestEnvironment.js deleted file mode 100644 index aeb87e8f6..000000000 --- a/packages/plugins/ui-theme/jest/jestEnvironment.js +++ /dev/null @@ -1 +0,0 @@ -jest.requireActual('babel/polyfill'); diff --git a/packages/plugins/ui-theme/jest/server-handlers.ts b/packages/plugins/ui-theme/jest/server-handlers.ts deleted file mode 100644 index b4abdd81c..000000000 --- a/packages/plugins/ui-theme/jest/server-handlers.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { rest } from 'msw'; - -const packagesPayload = require('./api/packages.json'); - -export const handlers = [ - rest.get('http://localhost:9000/-/verdaccio/data/packages', (req, res, ctx) => { - return res(ctx.json(packagesPayload)); - }), - - rest.post<{ username: string; password: string }, { token: string; username: string }>( - 'http://localhost:9000/-/verdaccio/sec/login', - // @ts-ignore - async (req, res, ctx) => { - const body = await req.json(); - if (body.username === 'fail') { - return ctx.status(401); - } - - return res( - ctx.json({ - username: body.username, - token: 'valid token', - }) - ); - } - ), -]; diff --git a/packages/plugins/ui-theme/jest/setup-env.ts b/packages/plugins/ui-theme/jest/setup-env.ts deleted file mode 100644 index 918693236..000000000 --- a/packages/plugins/ui-theme/jest/setup-env.ts +++ /dev/null @@ -1,17 +0,0 @@ -import '@testing-library/jest-dom'; -import 'whatwg-fetch'; - -import { server } from './server'; - -// mock load translations to avoid warnings -jest.mock('../src/i18n/loadTranslationFile'); - -beforeAll(() => { - server.listen({ - onUnhandledRequest: 'warn', - }); -}); -afterEach(() => server.resetHandlers()); -afterAll(() => { - server.close(); -}); diff --git a/packages/plugins/ui-theme/jest/unit/components/store/login.ts b/packages/plugins/ui-theme/jest/unit/components/store/login.ts deleted file mode 100644 index 354d5b833..000000000 --- a/packages/plugins/ui-theme/jest/unit/components/store/login.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { API_ERROR } from '../../../../lib/constants'; - -/** - * API mock for login endpoint - * @param {object} config configuration of api call - * @returns {promise} - */ -export default function login(config): Promise { - return new Promise(function loginCallbackPromise(resolve, reject): void { - const body = JSON.parse(config.body); - if (body.username === 'sam' && body.password === '1234') { - resolve({ - username: 'sam', - token: 'TEST_TOKEN', - }); - } else { - // perhaps we should rethink this reject regarding the eslint rule - /* eslint-disable prefer-promise-reject-errors */ - reject({ - error: API_ERROR.BAD_USERNAME_PASSWORD, - }); - } - }); -} diff --git a/packages/plugins/ui-theme/jest/unit/components/store/logo.ts b/packages/plugins/ui-theme/jest/unit/components/store/logo.ts deleted file mode 100644 index dab42d4d8..000000000 --- a/packages/plugins/ui-theme/jest/unit/components/store/logo.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Mock response for logo api - * @returns {promise} - */ -export default function (): Promise { - return Promise.resolve('http://localhost/-/static/logo.png'); -} diff --git a/packages/plugins/ui-theme/jest/unit/components/store/package.ts b/packages/plugins/ui-theme/jest/unit/components/store/package.ts deleted file mode 100644 index b1ea582bf..000000000 --- a/packages/plugins/ui-theme/jest/unit/components/store/package.ts +++ /dev/null @@ -1,174 +0,0 @@ -export const packageInformation = [ - { - name: 'jquery', - title: 'jQuery', - description: 'JavaScript library for DOM operations', - version: '3.3.2-pre', - main: 'dist/jquery.js', - homepage: 'https://jquery.com', - author: { - name: 'JS Foundation and other contributors', - url: 'https://github.com/jquery/jquery/blob/master/AUTHORS.txt', - avatar: '', - }, - repository: { - type: 'git', - url: 'https://github.com/jquery/jquery.git', - }, - keywords: ['jquery', 'javascript', 'browser', 'library'], - bugs: { - url: 'https://github.com/jquery/jquery/issues', - }, - license: 'MIT', - dependencies: {}, - devDependencies: { - 'babel-core': '7.0.0-beta.0', - 'babel-plugin-transform-es2015-for-of': '7.0.0-beta.0', - commitplease: '3.2.0', - 'core-js': '2.5.7', - 'eslint-config-jquery': '1.0.1', - grunt: '1.0.3', - 'grunt-babel': '7.0.0', - 'grunt-cli': '1.2.0', - 'grunt-compare-size': '0.4.2', - 'grunt-contrib-uglify': '3.3.0', - 'grunt-contrib-watch': '1.1.0', - 'grunt-eslint': '20.2.0', - 'grunt-git-authors': '3.2.0', - 'grunt-jsonlint': '1.1.0', - 'grunt-karma': '2.0.0', - 'grunt-newer': '1.3.0', - 'grunt-npmcopy': '0.1.0', - 'gzip-js': '0.3.2', - husky: '0.14.3', - insight: '0.10.1', - jsdom: '5.6.1', - karma: '2.0.3', - 'karma-browserstack-launcher': '1.3.0', - 'karma-chrome-launcher': '2.2.0', - 'karma-firefox-launcher': '1.1.0', - 'karma-qunit': '1.2.1', - 'load-grunt-tasks': '4.0.0', - 'native-promise-only': '0.8.1', - 'promises-aplus-tests': '2.1.2', - q: '1.5.1', - 'qunit-assert-step': '1.1.1', - qunitjs: '1.23.1', - 'raw-body': '2.3.3', - requirejs: '2.3.5', - sinon: '2.3.7', - sizzle: '2.3.3', - 'strip-json-comments': '2.0.1', - testswarm: '1.1.0', - 'uglify-js': '3.4.0', - }, - scripts: { - build: 'npm install && grunt', - start: 'grunt watch', - 'test:browserless': 'grunt && grunt test:slow', - 'test:browser': 'grunt && grunt karma:main', - test: 'grunt && grunt test:slow && grunt karma:main', - jenkins: 'npm run test:browserless', - precommit: 'grunt lint:newer qunit_fixture', - commitmsg: 'node node_modules/commitplease', - }, - commitplease: { - nohook: true, - components: [ - 'Docs', - 'Tests', - 'Build', - 'Support', - 'Release', - 'Core', - 'Ajax', - 'Attributes', - 'Callbacks', - 'CSS', - 'Data', - 'Deferred', - 'Deprecated', - 'Dimensions', - 'Effects', - 'Event', - 'Manipulation', - 'Offset', - 'Queue', - 'Selector', - 'Serialize', - 'Traversing', - 'Wrap', - ], - markerPattern: '^((clos|fix|resolv)(e[sd]|ing))|^(refs?)', - ticketPattern: '^((Closes|Fixes) ([a-zA-Z]{2,}-)[0-9]+)|^(Refs? [^#])', - }, - }, - { - name: 'lodash', - version: '4.17.4', - license: 'MIT', - private: true, - main: 'lodash.js', - author: { - name: 'John david dalton', - url: 'test url', - avatar: 'test avatar', - }, - engines: { - node: '>=4.0.0', - }, - sideEffects: false, - scripts: { - build: 'npm run build:main && npm run build:fp', - 'build:fp': 'node lib/fp/build-dist.js', - 'build:fp-modules': 'node lib/fp/build-modules.js', - 'build:main': 'node lib/main/build-dist.js', - 'build:main-modules': 'node lib/main/build-modules.js', - doc: 'node lib/main/build-doc github && npm run test:doc', - 'doc:fp': 'node lib/fp/build-doc', - 'doc:site': 'node lib/main/build-doc site', - 'doc:sitehtml': - 'optional-dev-dependency marky-markdown@^9.0.1 && npm run doc:site && node lib/main/build-site', - pretest: 'npm run build', - style: 'eslint *.js .internal/**/*.js', - test: 'npm run test:main && npm run test:fp', - 'test:doc': 'markdown-doctest doc/*.md', - 'test:fp': 'node test/test-fp', - 'test:main': 'node test/test', - validate: 'npm run style && npm run test', - }, - devDependencies: { - async: '^2.1.4', - benchmark: '^2.1.3', - chalk: '^1.1.3', - cheerio: '^0.22.0', - 'codecov.io': '~0.1.6', - coveralls: '^2.11.15', - 'curl-amd': '~0.8.12', - docdown: '~0.7.2', - dojo: '^1.12.1', - ecstatic: '^2.1.0', - eslint: '^3.15.0', - 'eslint-plugin-import': '^2.2.0', - 'fs-extra': '~1.0.0', - glob: '^7.1.1', - istanbul: '0.4.5', - jquery: '^3.1.1', - lodash: '4.17.3', - 'lodash-doc-globals': '^0.1.1', - 'markdown-doctest': '^0.9.1', - 'optional-dev-dependency': '^2.0.0', - platform: '^1.3.3', - 'qunit-extras': '^3.0.0', - qunitjs: '^2.1.0', - request: '^2.79.0', - requirejs: '^2.3.2', - 'sauce-tunnel': '^2.5.0', - 'uglify-js': '2.7.5', - webpack: '^1.14.0', - }, - greenkeeper: { - ignore: ['lodash'], - }, - }, -]; diff --git a/packages/plugins/ui-theme/jest/unit/components/store/packageMeta.ts b/packages/plugins/ui-theme/jest/unit/components/store/packageMeta.ts deleted file mode 100644 index 0035ab845..000000000 --- a/packages/plugins/ui-theme/jest/unit/components/store/packageMeta.ts +++ /dev/null @@ -1,590 +0,0 @@ -export const packageMeta = { - name: 'verdaccio', - 'dist-tags': { latest: '2.7.1', beta: '2.4.1-beta' }, - time: { - modified: '2017-12-14T15:43:27.317Z', - created: '2016-07-28T12:48:43.536Z', - '1.4.0': '2016-07-28T12:48:43.536Z', - '2.0.0': '2016-08-26T22:36:41.762Z', - '2.0.1': '2016-08-29T13:26:21.754Z', - '2.1.0': '2016-10-12T00:48:03.025Z', - '2.1.1': '2017-02-07T06:43:22.801Z', - '2.2.0-v20170212': '2017-02-12T14:48:27.322Z', - '2.1.2': '2017-03-09T06:25:28.107Z', - '2.1.3': '2017-03-29T20:03:36.850Z', - '2.1.4': '2017-04-13T20:08:41.131Z', - '2.1.5': '2017-04-22T09:07:39.821Z', - '2.1.6': '2017-05-12T07:43:36.616Z', - '2.1.7': '2017-05-14T13:50:14.016Z', - '2.1.10': '2017-06-03T09:53:52.449Z', - '2.2.0': '2017-06-08T19:02:53.618Z', - '2.2.1': '2017-06-17T16:23:14.158Z', - '2.2.2': '2017-07-02T13:13:13.304Z', - '2.2.3': '2017-07-04T20:43:59.442Z', - '2.2.4': '2017-07-05T17:28:07.187Z', - '2.2.5': '2017-07-05T17:34:11.089Z', - '2.2.6': '2017-07-13T05:04:54.418Z', - '2.2.7': '2017-07-15T23:27:24.523Z', - '2.3.0-beta': '2017-07-15T23:31:31.664Z', - '2.2.7-r': '2017-07-18T19:44:48.946Z', - '2.3.0-beta-1': '2017-07-22T16:27:45.025Z', - '2.3.0-beta-2': '2017-07-22T17:12:09.905Z', - '2.3.0-beta-3': '2017-07-22T17:35:05.771Z', - '2.3.0-beta-4': '2017-07-22T18:22:42.563Z', - '2.3.0': '2017-07-22T23:08:37.513Z', - '2.3.1-pre': '2017-07-24T05:50:40.852Z', - '2.3.1': '2017-07-25T05:24:27.651Z', - '2.3.2': '2017-07-28T23:05:36.431Z', - '2.3.3': '2017-07-29T10:05:30.120Z', - '2.3.4': '2017-07-29T10:18:44.061Z', - '2.3.5': '2017-08-14T06:22:57.686Z', - '2.3.6': '2017-08-17T04:30:44.872Z', - '2.4.0': '2017-09-23T08:01:22.780Z', - '2.4.1-beta': '2017-10-01T08:57:14.509Z', - '2.5.0': '2017-10-01T12:31:06.333Z', - '2.5.1': '2017-10-01T13:32:06.584Z', - '2.6.0': '2017-10-18T20:22:32.836Z', - '2.6.1': '2017-10-19T17:26:24.083Z', - '2.6.2': '2017-10-21T08:37:16.527Z', - '2.6.3': '2017-10-21T16:04:05.556Z', - '2.6.4': '2017-10-31T17:47:03.647Z', - '2.6.5': '2017-11-05T09:09:31.332Z', - '2.6.6': '2017-11-08T22:47:16.504Z', - '2.7.0': '2017-12-05T23:25:06.372Z', - '2.7.1': '2017-12-14T15:43:27.317Z', - }, - _uplinks: { - abc: { etag: 'ddfdxjn8m8n6gn70-8m', fetched: 1532297472000 }, - npmjs: { etag: '"5a272ad2-4f6b1"', fetched: 1513266232741 }, - xyz: { etag: '564748hydydygs-s7ehj', fetched: 1532124672000 }, - }, - _rev: '16-ba1b806df0298246', - _attachments: {}, - latest: { - name: 'verdaccio', - version: '2.7.1', - description: 'Private npm repository server', - author: { - name: 'User NPM', - email: 'test@author.local', - avatar: 'https://www.gravatar.com/avatar/a5a236ba477ee98908600c40cda74f4a', - }, - repository: { - type: 'git', - url: 'git://github.com/verdaccio/verdaccio.git', - }, - main: 'index.js', - bin: { verdaccio: './bin/verdaccio' }, - dependencies: { - '@verdaccio/file-locking': '0.0.3', - JSONStream: '^1.1.1', - 'apache-md5': '^1.1.2', - async: '^2.0.1', - 'body-parser': '^1.15.0', - bunyan: '^1.8.0', - chalk: '^2.0.1', - commander: '^2.11.0', - compression: '1.6.2', - cookies: '^0.7.0', - cors: '^2.8.3', - express: '4.15.3', - global: '^4.3.2', - handlebars: '4.0.5', - 'http-errors': '^1.4.0', - 'js-string-escape': '1.0.1', - 'js-yaml': '^3.6.0', - jsonwebtoken: '^7.4.1', - lockfile: '^1.0.1', - lodash: '4.17.4', - lunr: '^0.7.0', - marked: '0.3.6', - mime: '^1.3.6', - minimatch: '^3.0.2', - mkdirp: '^0.5.1', - pkginfo: '^0.4.0', - request: '^2.72.0', - semver: '^5.1.0', - 'unix-crypt-td-js': '^1.0.0', - }, - devDependencies: { - axios: '0.16.2', - 'babel-cli': '6.24.1', - 'babel-core': '6.25.0', - 'babel-eslint': '7.2.3', - 'babel-loader': '7.1.1', - 'babel-plugin-flow-runtime': '0.11.1', - 'babel-plugin-transform-decorators-legacy': '1.3.4', - 'babel-plugin-transform-runtime': '6.23.0', - 'babel-polyfill': '^6.26.0', - 'babel-preset-env': '1.5.2', - 'babel-preset-flow': '6.23.0', - 'babel-preset-react': '6.24.1', - 'babel-preset-stage-2': '6.24.1', - 'babel-preset-stage-3': '6.24.1', - 'babel-runtime': '6.23.0', - 'codacy-coverage': '2.0.2', - codecov: '2.2.0', - coveralls: '2.13.1', - 'css-loader': '0.28.4', - 'element-react': '1.0.16', - 'element-theme-default': '1.3.7', - eslint: '4.2.0', - 'eslint-config-google': '0.8.0', - 'eslint-loader': '1.8.0', - 'eslint-plugin-babel': '4.1.1', - 'eslint-plugin-flowtype': '2.35.0', - 'eslint-plugin-import': '2.6.1', - 'eslint-plugin-react': '7.1.0', - 'extract-text-webpack-plugin': '3.0.0', - 'file-loader': '0.11.2', - 'flow-runtime': '0.13.0', - 'friendly-errors-webpack-plugin': '1.6.1', - 'fs-extra': '4.0.1', - 'html-webpack-plugin': '2.29.0', - 'in-publish': '2.0.0', - 'localstorage-memory': '1.0.2', - mocha: '3.4.2', - 'mocha-lcov-reporter': '1.3.0', - 'node-sass': '4.5.3', - 'normalize.css': '7.0.0', - nyc: '11.0.3', - ora: '1.3.0', - 'prop-types': '15.5.10', - react: '15.6.1', - 'react-dom': '15.6.1', - 'react-hot-loader': '3.0.0-beta.7', - 'react-router-dom': '4.1.1', - 'react-syntax-highlighter': '5.6.2', - rimraf: '2.6.1', - 'sass-loader': '6.0.6', - 'source-map-loader': '0.2.1', - 'standard-version': '4.2.0', - 'style-loader': '0.18.2', - stylelint: '7.13.0', - 'stylelint-config-standard': '16.0.0', - 'stylelint-webpack-plugin': '0.8.0', - 'url-loader': '0.5.8', - webpack: '3.2.0', - 'webpack-dev-server': '2.5.0', - 'webpack-merge': '4.1.0', - }, - keywords: [ - 'private', - 'package', - 'repository', - 'registry', - 'enterprise', - 'modules', - 'proxy', - 'server', - ], - scripts: { - release: 'standard-version -a -s', - prepublish: 'in-publish && npm run build:webui || not-in-publish', - test: 'mocha ./test/functional ./test/unit --reporter=spec --full-trace', - 'pre:ci': 'npm run build:webui', - 'test:ci': 'npm run test:coverage', - 'test:only': 'mocha ./test/functional ./test/unit', - 'test:coverage': 'nyc npm t', - 'coverage:html': 'nyc report --reporter=html', - 'coverage:publish': 'nyc report --reporter=lcov | codecov', - lint: 'eslint .', - 'lint:css': "stylelint 'src/**/*.scss' --syntax scss", - 'pre:webpack': 'npm run lint && rimraf static/*', - 'dev:webui': 'babel-node tools/dev.server.js', - 'build:webui': 'npm run pre:webpack && webpack --config tools/webpack.prod.config.babel.js', - 'build:docker': 'docker build -t verdaccio . --no-cache', - 'build:docker:rpi': 'docker build -f Dockerfile.rpi -t verdaccio:rpi .', - }, - engines: { node: '>=4.6.1', npm: '>=2.15.9' }, - preferGlobal: true, - publishConfig: { registry: 'https://registry.verdaccio.org' }, - license: 'WTFPL', - contributors: [ - { - name: '030', - email: 'test1@test.local', - avatar: 'https://www.gravatar.com/avatar/4ef03c2bf8d8689527903212d96fb45b', - }, - { - name: 'User NPM', - email: 'test2@test.local', - avatar: 'https://www.gravatar.com/avatar/a5a236ba477ee98908600c40cda74f4a', - }, - { - name: 'User NPM', - email: 'test3@test.comu', - avatar: 'https://www.gravatar.com/avatar/41a61049006855759bd6ec82ef0543a0', - }, - { - name: 'Alex Vernacchia', - email: 'tes4@test.local', - avatar: 'https://www.gravatar.com/avatar/06975001f7f2be7052bcf978700c6112', - }, - { - name: 'Alexander Makarenko', - email: 'test5@test.local', - avatar: 'https://www.gravatar.com/avatar/d9acfc4ed4e49a436738ff26a722dce4', - }, - { - name: 'Alexandre-io', - email: 'test6@test.local', - avatar: 'https://www.gravatar.com/avatar/2e095c7cfd278f72825d0fed6e12e3b1', - }, - { - name: 'Aram Drevekenin', - email: 'test7@test.local', - avatar: 'https://www.gravatar.com/avatar/371edff6d79c39bb9e36bde39d41a4b0', - }, - { - name: 'Bart Dubois', - email: 'test8@test.local', - avatar: 'https://www.gravatar.com/avatar/4acf72b14fcb459286c988c4523bafc8', - }, - { - name: 'Barthélemy Vessemont', - email: 'test9@test.local', - avatar: 'https://www.gravatar.com/avatar/322cd2fad528a55c4351ec76d85ef525', - }, - { - name: 'Brandon Nicholls', - email: 'test10@test.local', - avatar: 'https://www.gravatar.com/avatar/2d3b462f08f214ed459967aa7ef206f7', - }, - { - name: 'Bren Norris', - email: 'test11@test.local', - avatar: 'https://www.gravatar.com/avatar/465a42204a22efada0f15b46a7cdad3a', - }, - { - name: 'Brett Trotter', - email: 'test12@test.local', - avatar: 'https://www.gravatar.com/avatar/27a54519dcbe64c6d705f3cc4854595a', - }, - { - name: 'Brian Peacock', - email: 'test13@test.local', - avatar: 'https://www.gravatar.com/avatar/3dd3d627330e7e048c13a7480f19842e', - }, - { - name: 'Cedric Darne', - email: 'test14@test.local', - avatar: 'https://www.gravatar.com/avatar/0a617cebc6539940d7956c86e86c72a6', - }, - { - name: 'Chad Killingsworth', - email: 'test15@test.local', - avatar: 'https://www.gravatar.com/avatar/a5825b2d69311e559e28a535e5f0d483', - }, - { - name: 'Chris Breneman', - email: 'test16@test.local', - avatar: 'https://www.gravatar.com/avatar/3c5c3edef955c93edac672cbad04d7cd', - }, - { - name: 'Cody Droz', - email: 'test17@test.local', - avatar: 'https://www.gravatar.com/avatar/b762ce4d14acfece36e783b1592d882b', - }, - { - name: 'Daniel Rodríguez Rivero', - email: 'test18@test.local', - avatar: 'https://www.gravatar.com/avatar/ac7f548c31e8a002cfa41bd4c71e222d', - }, - { - name: 'Denis Babineau', - email: 'test19@test.local', - avatar: 'https://www.gravatar.com/avatar/ee5a522e067759ba0403824ecebeab4d', - }, - { - name: 'Emmanuel Narh', - email: 'test20@test.local', - avatar: 'https://www.gravatar.com/avatar/93a84a6120969fd181785ff9de834f0a', - }, - { - name: 'Fabio Poloni', - email: 'test21@test.local', - avatar: 'https://www.gravatar.com/avatar/f9a05677360e5f52fcca6e1af9b0f2ee', - }, - { - name: 'Facundo Chambó', - email: 'test22@test.local', - avatar: 'https://www.gravatar.com/avatar/ec9e7c590ba4081c25fcf197f90a4ea0', - }, - { - name: 'Guilherme Bernal', - email: 'test23@test.local', - avatar: 'https://www.gravatar.com/avatar/e5d55dcf2495618e8b9f8778f8353ee0', - }, - { - name: 'Jakub Jirutka', - email: 'test24@test.local', - avatar: 'https://www.gravatar.com/avatar/061bdb74aa4a543108658b277a257b4b', - }, - { - name: 'James Newell', - email: 'test25@test.local', - avatar: 'https://www.gravatar.com/avatar/825190aaae6ec7fd95085e1fb6f261d2', - }, - { - name: 'Jan Vansteenkiste', - email: 'test26@test.local', - avatar: 'https://www.gravatar.com/avatar/41835625a324201c796a0a0cffe4796b', - }, - { - name: 'Jannis Achstetter', - email: 'test27@test.local', - avatar: 'https://www.gravatar.com/avatar/92d1cce007b032f4a63c6df764f18030', - }, - { - name: 'Jeremy Moritz', - email: 'test28@test.local', - avatar: 'https://www.gravatar.com/avatar/008127e8f10293f43e62de3b7b3520e1', - }, - { - name: 'John Gozde', - email: 'test29@test.local', - avatar: 'https://www.gravatar.com/avatar/3e8927c60cb043a56fdd6531cfcaddbc', - }, - { - name: 'Jon de la Motte', - email: 'test30@test.local', - avatar: 'https://www.gravatar.com/avatar/126c1ea4fdb20bbb85c3ff735b7b0964', - }, - { - name: 'Joseph Gentle', - email: 'test31@test.local', - avatar: 'https://www.gravatar.com/avatar/484f0b8ba8b7cc43db0be8f910a91254', - }, - { - name: 'José De Paz', - email: 'test32@test.local', - avatar: 'https://www.gravatar.com/avatar/2532122835f5ebf1642b707ae088c895', - }, - { - name: 'Juan Carlos Picado', - email: 'test33@test.local', - avatar: 'https://www.gravatar.com/avatar/c676605ff39f9c7a43f5518a8ce54e12', - }, - { - name: 'Juan Carlos Picado', - email: 'test34@test.local', - avatar: 'https://www.gravatar.com/avatar/fba48015a688c38cc84e5b55b07858c0', - }, - { - name: 'User NPM', - email: 'test35@test.local', - avatar: 'https://www.gravatar.com/avatar/fba48015a688c38cc84e5b55b07858c0', - }, - { - name: 'User NPM @nickname', - email: 'test36@test.local', - avatar: 'https://www.gravatar.com/avatar/fba48015a688c38cc84e5b55b07858c0', - }, - { - name: 'Kalman Speier', - email: 'test37@test.local', - avatar: 'https://www.gravatar.com/avatar/272806ba17639e2fbf811e51eb8bfb99', - }, - { - name: 'Keyvan Fatehi', - email: 'test38@test.local', - avatar: 'https://www.gravatar.com/avatar/22735d1ba5765955914eb2d597dfaab5', - }, - { - name: 'Kody J. Peterson', - email: 'test39@test.local', - avatar: 'https://www.gravatar.com/avatar/918a15afc52e9b0a67b2651191b23d04', - }, - { - name: 'Madison Grubb', - email: 'test40@test.local', - avatar: 'https://www.gravatar.com/avatar/73b84fdf661c11d48d3370bfa197162b', - }, - { - name: 'Manuel de Brito Fontes', - email: 'test41@test.local', - avatar: 'https://www.gravatar.com/avatar/8798ca0a499428e5e8f25d3614ac8b6e', - }, - { - name: 'Mark Doeswijk', - email: 'test42@test.local', - avatar: 'https://www.gravatar.com/avatar/0d70ebd6c46dc01502bfab5f8c2d2bc5', - }, - { - name: 'Meeeeow', - email: 'test43@test.local', - avatar: 'https://www.gravatar.com/avatar/baa061890d7b352ba121082272419a8a', - }, - { - name: 'Meeeeow', - email: 'test44@test.local', - avatar: 'https://www.gravatar.com/avatar/12a36e093451d4c0f75d4240960ce29b', - }, - { - name: 'Michael Arnel', - email: 'test45@test.local', - avatar: 'https://www.gravatar.com/avatar/5f9a5ed24c63609d52651258f6dd8c12', - }, - { - name: 'Michael Crowe', - email: 'test46@test.local', - avatar: 'https://www.gravatar.com/avatar/eec9ee62019852da28a3bc91c57907f9', - }, - { - name: 'Miguel Mejias', - email: 'test47@test.local', - avatar: 'https://www.gravatar.com/avatar/7289a01fedfdb9ddf855ee4dd4d41ae2', - }, - { - name: 'Miroslav Bajtoš', - email: 'test48@test.local', - avatar: 'https://www.gravatar.com/avatar/b4d8831300713259f74aea79f842ca57', - }, - { - name: 'Nate Ziarek', - email: 'test49@test.local', - avatar: 'https://www.gravatar.com/avatar/6442023756294fd43aa518bbe5cc6dcc', - }, - { - name: 'Nick', - email: 'test50@test.local', - avatar: 'https://www.gravatar.com/avatar/8a810f12c9624ea2092852fe7c19f1ee', - }, - { - name: 'Piotr Synowiec', - email: 'test51@test.local', - avatar: 'https://www.gravatar.com/avatar/87028f33a3e1e5b4201c371abddf93e2', - }, - { - name: 'Rafael Cesar', - email: 'test52@test.local', - avatar: 'https://www.gravatar.com/avatar/204ed93fa5be7e2f9f299ad8bca6431f', - }, - { - name: 'Robert Ewald', - email: 'test53@test.local', - avatar: 'https://www.gravatar.com/avatar/ec2166ce419f78fb354f128b01a4a44d', - }, - { - name: 'Robert Groh', - email: 'test54@test.local', - avatar: 'https://www.gravatar.com/avatar/565ccb5374a3e0e31a75f11da2eb57aa', - }, - { - name: 'Robin Persson', - email: 'test55@test.local', - avatar: 'https://www.gravatar.com/avatar/99da46e4d59664134b176869340f464b', - }, - { - name: 'Romain Lai-King', - email: 'test56@test.local', - avatar: 'https://www.gravatar.com/avatar/69d0370c58399d0e0bbd15ccabfe1ec5', - }, - { - name: 'Ryan Graham', - email: 'test57@test.local', - avatar: 'https://www.gravatar.com/avatar/8bd1dd86bbf8705a5a702b86a2f3a390', - }, - { - name: 'Ryan Graham', - email: 'test58@test.local', - avatar: 'https://www.gravatar.com/avatar/e272ab422c1c629e9be26cba8b6c0166', - }, - { - name: 'Sam Day', - email: 'test59@test.local', - avatar: 'https://www.gravatar.com/avatar/1886554b0562a0eeeb78a4d1f27917ea', - }, - { - name: 'Tarun Garg', - email: 'test60@test.local', - avatar: 'https://www.gravatar.com/avatar/185e200c3451cfbe341f0e758626303a', - }, - { - name: 'Thomas Cort', - email: 'test61@test.local', - avatar: 'https://www.gravatar.com/avatar/120d2921c33c1bd8dedfce67a28dcc63', - }, - { - name: 'Tom Vincent', - email: 'test62@test.local', - avatar: 'https://www.gravatar.com/avatar/fb0c7faeda7f5d5632182a3d80381bfa', - }, - { - name: 'Trent Earl', - email: 'test63@test.local', - avatar: 'https://www.gravatar.com/avatar/1e30abe66d21824b89c28d05e5b57d84', - }, - { - name: 'Yannick Croissant', - email: 'test64@test.local', - avatar: 'https://www.gravatar.com/avatar/1e619ddb2a180222dd3d9f0348e65b9b', - }, - { - name: 'Yannick Galatol', - email: 'test65@test.local', - avatar: 'https://www.gravatar.com/avatar/2f624f92326fef845bb2c07b392b7e48', - }, - { - name: 'cklein', - email: 'test66@test.local', - avatar: 'https://www.gravatar.com/avatar/f8288370380881cf3afc5a92a63d652d', - }, - { - name: 'danielo515', - email: 'test67@test.local', - avatar: 'https://www.gravatar.com/avatar/ac7f548c31e8a002cfa41bd4c71e222d', - }, - { - name: 'jmwilkinson', - email: 'test68@test.local', - avatar: 'https://www.gravatar.com/avatar/3b99683f0a4c26a8906ecbe7968a4ade', - }, - { - name: 'nickname', - email: 'test69@test.local', - avatar: 'https://www.gravatar.com/avatar/fba48015a688c38cc84e5b55b07858c0', - }, - { - name: 'nickname', - email: 'test70@test.local', - avatar: 'https://www.gravatar.com/avatar/047ba1e853d20459e531619af5493c56', - }, - { - name: 'maxlaverse', - email: 'test71@test.local', - avatar: 'https://www.gravatar.com/avatar/74324a2900906c45949a8c5cee6d0730', - }, - { - name: 'saheba', - email: 'test72@test.local', - avatar: 'https://www.gravatar.com/avatar/77644c51856cab149e0f550c5f0c6ed8', - }, - { - name: 'steve-p-com', - email: 'test73@test.local', - avatar: 'https://www.gravatar.com/avatar/bef1821d3036b8b9242c4999826c1c3c', - }, - { - name: 'trent.earl', - email: 'test74@test.local', - avatar: 'https://www.gravatar.com/avatar/f84b8ae496f7c988dce5a71d773e75bb', - }, - ], - readmeFilename: 'README.md', - gitHead: '567dbe327819ed30afb96906f8d43f19740e2e3d', - bugs: { url: 'https://github.com/verdaccio/verdaccio/issues' }, - homepage: 'https://github.com/verdaccio/verdaccio#readme', - _id: 'verdaccio@2.7.1', - _shasum: '958c919180e7f2ed6775f48d4ec64bd8de2a14df', - _from: '.', - _npmVersion: '3.10.10', - _nodeVersion: '6.9.5', - _npmUser: {}, - dist: { - shasum: '958c919180e7f2ed6775f48d4ec64bd8de2a14df', - tarball: 'https://registry.verdaccio.org/verdaccio/-/verdaccio-2.7.1.tgz', - }, - }, -}; diff --git a/packages/plugins/ui-theme/package.json b/packages/plugins/ui-theme/package.json index 71a7b52f6..6ea9cbf37 100644 --- a/packages/plugins/ui-theme/package.json +++ b/packages/plugins/ui-theme/package.json @@ -16,8 +16,8 @@ "@emotion/babel-plugin": "11.10.6", "@emotion/css": "11.10.6", "@emotion/jest": "11.11.0", - "@emotion/react": "11.10.6", - "@emotion/styled": "11.10.6", + "@emotion/react": "11.11.4", + "@emotion/styled": "11.11.5", "@mui/icons-material": "5.16.5", "@mui/material": "5.16.5", "@mui/styles": "5.16.5", @@ -58,12 +58,6 @@ "raw-loader": "4.0.2", "react": "18.2.0", "react-dom": "18.2.0", - "jest": "29.7.0", - "jest-diff": "29.7.0", - "jest-environment-jsdom": "29.7.0", - "jest-environment-jsdom-global": "4.0.0", - "jest-environment-node": "29.7.0", - "jest-junit": "16.0.0", "react-hook-form": "7.52.1", "react-hot-loader": "4.13.1", "react-i18next": "13.5.0", @@ -87,6 +81,7 @@ "url-loader": "4.1.1", "validator": "13.12.0", "webpack": "5.93.0", + "vite-plugin-markdown": "2.2.0", "webpack-bundle-analyzer": "4.10.2", "webpack-bundle-size-analyzer": "3.1.0", "webpack-cli": "^4.10.0", @@ -109,12 +104,10 @@ "scripts": { "type-check": "tsc --noEmit -p tsconfig.build.json", "start": "babel-node tools/dev.server.js", - "test:clean": "jest --clearCache", - "test": "cross-env TZ=UTC jest --config ./jest/jest.config.js", - "test:update-snapshot": "yarn run test -- -u", + "test": "cross-env TZ=UTC vitest run", "lint": "pnpm lint:js && pnpm lint:css", "clean": "rimraf ./static", - "lint:css": "yarn stylelint \"src/**/styles.ts\"", + "lint:css": "stylelint \"src/**/styles.ts\"", "verdaccio:server": "node tools/verdaccio.js", "build": "pnpm clean && webpack --config tools/webpack.prod.config.babel.js", "build:stats": "webpack --config tools/webpack.prod.config.babel.js --json > stats.json", diff --git a/packages/plugins/ui-theme/src/App/App.test.tsx b/packages/plugins/ui-theme/src/App/App.test.tsx index 6bc80e351..0a5cf4171 100644 --- a/packages/plugins/ui-theme/src/App/App.test.tsx +++ b/packages/plugins/ui-theme/src/App/App.test.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { act, renderWithStore, screen } from 'verdaccio-ui/utils/test-react-testing-library'; +import { vi } from 'vitest'; import { store } from '@verdaccio/ui-components'; @@ -7,8 +8,8 @@ import App from './App'; // force the windows to expand to display items // https://github.com/bvaughn/react-virtualized/issues/493#issuecomment-640084107 -jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600); -jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600); +vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600); +vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600); /* eslint-disable react/jsx-no-bind*/ describe('', () => { diff --git a/packages/plugins/ui-theme/src/__mocks__/react-markdown.tsx b/packages/plugins/ui-theme/src/__mocks__/react-markdown.tsx deleted file mode 100644 index 706e532d5..000000000 --- a/packages/plugins/ui-theme/src/__mocks__/react-markdown.tsx +++ /dev/null @@ -1,8 +0,0 @@ -// eslint-disable -import React from 'react'; - -// @ts-ignore -export default function ({ children }) { - return <>{children}; -} -// eslint-enable diff --git a/packages/plugins/ui-theme/src/__mocks__/remark-plugin.ts b/packages/plugins/ui-theme/src/__mocks__/remark-plugin.ts deleted file mode 100644 index ea9b101e1..000000000 --- a/packages/plugins/ui-theme/src/__mocks__/remark-plugin.ts +++ /dev/null @@ -1 +0,0 @@ -export default function () {} diff --git a/packages/plugins/ui-theme/vitest.config.ts b/packages/plugins/ui-theme/vitest.config.ts new file mode 100644 index 000000000..33e0d3551 --- /dev/null +++ b/packages/plugins/ui-theme/vitest.config.ts @@ -0,0 +1,35 @@ +import react from '@vitejs/plugin-react'; +import path from 'node:path'; +import markdown from 'vite-plugin-markdown'; +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'jsdom', + globals: true, + setupFiles: ['./vitest/setup.ts'], + exclude: ['node_modules', './build/'], + snapshotFormat: { + escapeString: true, + printBasicPrototype: true, + }, + assetsInclude: ['**/*.md'], + alias: { + // https://github.com/vitest-dev/vitest/issues/5664#issuecomment-2093986338 + '@emotion/react': path.resolve('node_modules/@emotion/react/dist/emotion-react.cjs.mjs'), + }, + }, + plugins: [ + markdown(), + react({ + babel: { + plugins: ['@emotion'], + }, + }), + ], + resolve: { + alias: { + 'verdaccio-ui/utils': path.resolve(__dirname, './src/utils'), + }, + }, +}); diff --git a/packages/plugins/ui-theme/jest/setup.ts b/packages/plugins/ui-theme/vitest.setup.ts similarity index 79% rename from packages/plugins/ui-theme/jest/setup.ts rename to packages/plugins/ui-theme/vitest.setup.ts index de5344ed2..de2eddb00 100644 --- a/packages/plugins/ui-theme/jest/setup.ts +++ b/packages/plugins/ui-theme/vitest.setup.ts @@ -1,8 +1,7 @@ -/** - * Setup configuration for Jest - * This file includes global settings for the JEST environment. - */ +import '@testing-library/jest-dom'; import 'mutationobserver-shim'; +import { vi } from 'vitest'; +import 'whatwg-fetch'; // @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'. global.__VERDACCIO_BASENAME_UI_OPTIONS = { @@ -24,8 +23,8 @@ global.__VERDACCIO_BASENAME_UI_OPTIONS = { // @ts-ignore : Property 'document' does not exist on type 'Global'. if (global.document) { // @ts-ignore : Type 'Mock<{ selectNodeContents: () => void; }, []>' is not assignable to type '() => Range'. - document.createRange = jest.fn((): void => ({ + document.createRange = vi.fn((): void => ({ selectNodeContents: (): void => {}, })); - document.execCommand = jest.fn(); + document.execCommand = vi.fn(); } diff --git a/packages/ui-components/jest/setup.ts b/packages/plugins/ui-theme/vitest/setup.ts similarity index 70% rename from packages/ui-components/jest/setup.ts rename to packages/plugins/ui-theme/vitest/setup.ts index de5344ed2..8b66c449c 100644 --- a/packages/ui-components/jest/setup.ts +++ b/packages/plugins/ui-theme/vitest/setup.ts @@ -2,7 +2,16 @@ * Setup configuration for Jest * This file includes global settings for the JEST environment. */ +import '@testing-library/jest-dom'; import 'mutationobserver-shim'; +import { vi } from 'vitest'; +import { Headers, Request, Response, fetch } from 'whatwg-fetch'; + +// Override the global fetch and related APIs +global.fetch = fetch; +global.Headers = Headers; +global.Request = Request; +global.Response = Response; // @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'. global.__VERDACCIO_BASENAME_UI_OPTIONS = { @@ -24,8 +33,8 @@ global.__VERDACCIO_BASENAME_UI_OPTIONS = { // @ts-ignore : Property 'document' does not exist on type 'Global'. if (global.document) { // @ts-ignore : Type 'Mock<{ selectNodeContents: () => void; }, []>' is not assignable to type '() => Range'. - document.createRange = jest.fn((): void => ({ + document.createRange = vi.fn((): void => ({ selectNodeContents: (): void => {}, })); - document.execCommand = jest.fn(); + document.execCommand = vi.fn(); } diff --git a/packages/ui-components/.babelrc b/packages/ui-components/.babelrc index 7488c40e0..30dd8e7c5 100644 --- a/packages/ui-components/.babelrc +++ b/packages/ui-components/.babelrc @@ -1,8 +1,16 @@ { "extends": "../../.babelrc", "plugins": ["@emotion"], - "sourceMaps" : "inline", "presets": [ + [ + "@babel/preset-env", + { + "modules": false, + "targets": { + "esmodules": true + } + } + ], "@babel/preset-react" ] } diff --git a/packages/ui-components/CHANGELOG.md b/packages/ui-components/CHANGELOG.md deleted file mode 100644 index 43af16245..000000000 --- a/packages/ui-components/CHANGELOG.md +++ /dev/null @@ -1,278 +0,0 @@ -# @verdaccio/ui-components - -## 4.0.0-next-8.2 - -### Patch Changes - -- c4e8875: chore(ui): replace react-json-view -- 409494a: chore(ui): typing for Theme - -## 4.0.0-next-8.1 - -### Minor Changes - -- 6a8154c: feat: update logger pino to latest - -## 4.0.0-next-8.0 - -### Major Changes - -- chore: move v7 next to v8 next - -## 3.0.0 - -### Major Changes - -- 47f61c6: feat!: bump to v7 -- e7ebccb: update major dependencies, remove old nodejs support - -### Minor Changes - -- 10dd81f: feat: complete overhaul of web user interface -- 580319a: feat: ui improvements - - Some UI improvements - - - download progress indicator: https://github.com/verdaccio/verdaccio/discussions/4068 - - fix dark mode and readme css support https://github.com/verdaccio/verdaccio/discussions/3942 https://github.com/verdaccio/verdaccio/discussions/3467 - - fix global for yarn packages and add version to the packages on copy - - feat: hide deprecated versions option - - fix: improve deprecated package style - - feat: display deprecated versions - -- c9962fe: feat: forbidden user interface - -### Patch Changes - -- 92f1c34: - fixed login state when token is expired (@ku3mi41 in #3980) -- 5a77414: chore: fix type for country flags -- 02ba426: fix: display labels for engine versions -- ba53d1e: feat: versions filter by semver range -- 3b3cf86: chore: sync dependency defs between ui-components and ui-theme -- 3323599: fix: render READMEs with correct font and highlighting -- 96b2857: chore(ui): update babel dependencies -- 5210408: fix: ui dialog break pages on open due remark error -- 117eb1c: fix: change bundleDependencies to array - -## 3.0.0-next-7.9 - -### Patch Changes - -- 5a77414: chore: fix type for country flags -- 3b3cf86: chore: sync dependency defs between ui-components and ui-theme -- 96b2857: chore(ui): update babel dependencies - -## 3.0.0-next-7.8 - -### Minor Changes - -- 10dd81f: feat: complete overhaul of web user interface - -## 3.0.0-next-7.7 - -### Patch Changes - -- 117eb1c: fix: change bundleDependencies to array - -## 3.0.0-next-7.6 - -### Patch Changes - -- ba53d1e: feat: versions filter by semver range - -## 3.0.0-next-7.5 - -### Minor Changes - -- c9962fe: feat: forbidden user interface - -## 3.0.0-next-7.4 - -### Patch Changes - -- 5210408: fix: ui dialog break pages on open due remark error - -## 3.0.0-next-7.3 - -### Patch Changes - -- 3323599: fix: render READMEs with correct font and highlighting - -## 3.0.0-next.2 - -### Major Changes - -- e7ebccb61: update major dependencies, remove old nodejs support - -### Minor Changes - -- 580319a53: feat: ui improvements - - Some UI improvements - - - download progress indicator: https://github.com/verdaccio/verdaccio/discussions/4068 - - fix dark mode and readme css support https://github.com/verdaccio/verdaccio/discussions/3942 https://github.com/verdaccio/verdaccio/discussions/3467 - - fix global for yarn packages and add version to the packages on copy - - feat: hide deprecated versions option - - fix: improve deprecated package style - - feat: display deprecated versions - -### Patch Changes - -- 02ba426ce: fix: display labels for engine versions - -## 3.0.0-next.1 - -### Patch Changes - -- 92f1c34ae: - fixed login state when token is expired (@ku3mi41 in #3980) - -## 3.0.0-next.0 - -### Major Changes - -- feat!: bump to v7 - -## 2.0.0 - -### Major Changes - -- 999787974: feat(web): components for custom user interfaces - - Provides a package that includes all components from the user interface, instead being embedded at the `@verdaccio/ui-theme` package. - - ``` - npm i -D @verdaccio/ui-components - ``` - - The package contains - - - Components - - Providers - - Redux Storage - - Layouts (precomposed layouts ready to use) - - Custom Material Theme - - The `@verdaccio/ui-theme` will consume this package and will use only those are need it. - - > Prerequisites are using Redux, Material-UI and Translations with `i18next`. - - Users could have their own Material UI theme and build custom layouts, adding new features without the need to modify the default project. - -- 781ac9ac2: fix package configuration issues - -### Minor Changes - -- 974cd8c19: fix: startup messages improved and logs support on types -- 7344a7fcf: feat: ui bugfixes and improvements -- ddb6a2239: feat: signature package - -### Patch Changes - -- 7ef599cc4: fix: missing version on footer -- 0dafa9826: fix: undefined field on missing count - -## 2.0.0-6-next.10 - -### Minor Changes - -- 7344a7fcf: feat: ui bugfixes and improvements - -## 2.0.0-6-next.9 - -### Patch Changes - -- 0dafa982: fix: undefined field on missing count - -## 2.0.0-6-next.8 - -### Patch Changes - -- Updated dependencies [16e38df8] - - @verdaccio/types@11.0.0-6-next.25 - -## 2.0.0-6-next.7 - -### Patch Changes - -- 7ef599cc: fix: missing version on footer -- Updated dependencies [7ef599cc] - - @verdaccio/types@11.0.0-6-next.24 - -## 2.0.0-6-next.6 - -### Minor Changes - -- 974cd8c1: fix: startup messages improved and logs support on types - -### Patch Changes - -- Updated dependencies [974cd8c1] - - @verdaccio/types@11.0.0-6-next.23 - -## 2.0.0-6-next.5 - -### Minor Changes - -- ddb6a223: feat: signature package - -### Patch Changes - -- Updated dependencies [dc571aab] - - @verdaccio/types@11.0.0-6-next.22 - -## 2.0.0-6-next.4 - -### Major Changes - -- 781ac9ac: fix package configuration issues - -### Patch Changes - -- Updated dependencies [4fc21146] - - @verdaccio/types@11.0.0-6-next.21 - -## 2.0.0-6-next.3 - -### Patch Changes - -- Updated dependencies [45c03819] - - @verdaccio/types@11.0.0-6-next.20 - -## 2.0.0-6-next.2 - -### Patch Changes - -- Updated dependencies [ef88da3b] - - @verdaccio/types@11.0.0-6-next.19 - -## 2.0.0-6-next.1 - -### Major Changes - -- 99978797: feat(web): components for custom user interfaces - - Provides a package that includes all components from the user interface, instead being embedded at the `@verdaccio/ui-theme` package. - - ``` - npm i -D @verdaccio/ui-components - ``` - - The package contains - - - Components - - Providers - - Redux Storage - - Layouts (precomposed layouts ready to use) - - Custom Material Theme - - The `@verdaccio/ui-theme` will consume this package and will use only those are need it. - - > Prerequisites are using Redux, Material-UI and Translations with `i18next`. - - Users could have their own Material UI theme and build custom layouts, adding new features without the need to modify the default project. - -### Patch Changes - -- Updated dependencies [99978797] - - @verdaccio/types@11.0.0-6-next.18 diff --git a/packages/ui-components/jest/identity.js b/packages/ui-components/jest/identity.js deleted file mode 100644 index f3132f258..000000000 --- a/packages/ui-components/jest/identity.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -let Reflect; -let idObj; - -function checkIsNodeV6OrAbove() { - if (typeof process === 'undefined') { - return false; - } - - return parseInt(process.versions.node.split('.')[0], 10) >= 6; -} - -if (!checkIsNodeV6OrAbove()) { - Reflect = require('harmony-reflect'); -} - -idObj = new Proxy( - {}, - { - get: function getter(target, key) { - if (key === '__esModule') { - return false; - } - return key; - }, - } -); - -module.exports = idObj; diff --git a/packages/ui-components/jest/jest.config.js b/packages/ui-components/jest/jest.config.js deleted file mode 100644 index 4524fb3ec..000000000 --- a/packages/ui-components/jest/jest.config.js +++ /dev/null @@ -1,43 +0,0 @@ -const config = require('../../../jest/config'); - -module.exports = Object.assign({}, config, { - testEnvironment: 'jest-environment-jsdom-global', - transform: { - '^.+\\.(js|ts|tsx)$': 'babel-jest', - }, - moduleFileExtensions: ['js', 'ts', 'tsx'], - testEnvironmentOptions: { - url: 'http://localhost:9000/', - }, - rootDir: '..', - collectCoverage: true, - setupFilesAfterEnv: ['/jest/setup-env.ts'], - setupFiles: ['/jest/setup.ts'], - transformIgnorePatterns: ['/node_modules/(?!react-syntax-highlighter)'], - snapshotSerializers: ['@emotion/jest/serializer'], - collectCoverageFrom: [ - 'src/**/*.{ts,tsx}', - '!**/node_modules/**', - '!src/**/*.stories.{ts,tsx}', - '!src/types/**', - ], - modulePathIgnorePatterns: ['/build/'], - moduleNameMapper: { - '\\.(s?css)$': '/jest/identity.js', - '\\.(png)$': '/jest/identity.js', - '\\.(svg)$': '/jest/unit/empty.ts', - '\\.(jpg)$': '/jest/unit/empty.ts', - '\\.(md)$': '/jest/unit/empty-string.ts', - 'react-markdown': '/src/__mocks__/react-markdown.tsx', - 'remark-*': '/src/__mocks__/remark-plugin.ts', - }, - coverageReporters: ['text', 'html'], - coverageThreshold: { - global: { - branches: 70, - functions: 75, - lines: 80, - statements: 81, - }, - }, -}); diff --git a/packages/ui-components/jest/jestEnvironment.js b/packages/ui-components/jest/jestEnvironment.js deleted file mode 100644 index aeb87e8f6..000000000 --- a/packages/ui-components/jest/jestEnvironment.js +++ /dev/null @@ -1 +0,0 @@ -jest.requireActual('babel/polyfill'); diff --git a/packages/ui-components/jest/server.ts b/packages/ui-components/jest/server.ts deleted file mode 100644 index a6ef2e4ce..000000000 --- a/packages/ui-components/jest/server.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { setupServer } from 'msw/node'; - -import { handlers } from './server-handlers'; - -const server = setupServer(...handlers); -export { server }; diff --git a/packages/ui-components/jest/setup-env.ts b/packages/ui-components/jest/setup-env.ts deleted file mode 100644 index ad66ea25d..000000000 --- a/packages/ui-components/jest/setup-env.ts +++ /dev/null @@ -1,14 +0,0 @@ -import '@testing-library/jest-dom'; -import 'whatwg-fetch'; - -import { server } from './server'; - -beforeAll(() => { - server.listen({ - onUnhandledRequest: 'warn', - }); -}); -afterEach(() => server.resetHandlers()); -afterAll(() => { - server.close(); -}); diff --git a/packages/ui-components/jest/unit/empty-string.ts b/packages/ui-components/jest/unit/empty-string.ts deleted file mode 100644 index 43cd68370..000000000 --- a/packages/ui-components/jest/unit/empty-string.ts +++ /dev/null @@ -1 +0,0 @@ -export default 'empty string module'; diff --git a/packages/ui-components/jest/unit/empty.ts b/packages/ui-components/jest/unit/empty.ts deleted file mode 100644 index ff8b4c563..000000000 --- a/packages/ui-components/jest/unit/empty.ts +++ /dev/null @@ -1 +0,0 @@ -export default {}; diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index 7f13f4d22..7e324f21c 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -8,8 +8,7 @@ "main": "./build/index.js", "types": "build/index.d.ts", "scripts": { - "test": "cross-env TZ=UTC jest --config jest/jest.config.js", - "test:html": "cross-env TZ=UTC jest --config jest/jest.config.js --coverage-reporters=html", + "test": "cross-env TZ=UTC vitest run", "clean": "rimraf ./build", "type-check": "tsc --noEmit -p tsconfig.build.json", "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", @@ -21,8 +20,8 @@ "build-storybook": "build-storybook" }, "dependencies": { - "@emotion/react": "11.10.6", - "@emotion/styled": "11.10.6", + "@emotion/react": "11.11.4", + "@emotion/styled": "11.11.5", "@fontsource/material-icons": "^4.5.4", "@fontsource/roboto": "^4.5.8", "@microlink/react-json-view": "^1.23.3", @@ -61,7 +60,6 @@ "devDependencies": { "@babel/core": "7.24.9", "@emotion/babel-plugin": "11.12.0", - "@emotion/jest": "11.13.0", "@storybook/addon-actions": "^6.5.15", "@storybook/addon-essentials": "^6.5.15", "@storybook/addon-interactions": "^6.5.15", @@ -76,12 +74,11 @@ "@types/hast": "^2.0.0", "@types/react-router": "^5.1.20", "@types/unist": "^2.0.0", - "jest": "29.7.0", - "jest-diff": "29.7.0", - "jest-environment-jsdom": "29.7.0", - "jest-environment-jsdom-global": "4.0.0", - "jest-environment-node": "29.7.0", - "jest-junit": "16.0.0", + "whatwg-fetch": "3.6.20", + "jsdom": "^24.0.0", + "mutationobserver-shim": "0.3.7", + "vitest": "2.1.2", + "@vitejs/plugin-react": "^4.3.4", "@verdaccio/types": "workspace:13.0.0-next-8.1", "babel-loader": "9.1.3", "mockdate": "3.0.5", diff --git a/packages/ui-components/src/AppTest/AppRoute.test.tsx b/packages/ui-components/src/AppTest/AppRoute.test.tsx index e497a9c1c..c62798a7e 100644 --- a/packages/ui-components/src/AppTest/AppRoute.test.tsx +++ b/packages/ui-components/src/AppTest/AppRoute.test.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { MemoryRouter } from 'react-router'; +import { vi } from 'vitest'; import { store } from '../'; import { act, renderWithStore, screen, waitFor } from '../test/test-react-testing-library'; @@ -7,8 +8,8 @@ import AppRoute from './AppRoute'; // force the windows to expand to display items // https://github.com/bvaughn/react-virtualized/issues/493#issuecomment-640084107 -jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600); -jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600); +vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600); +vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600); function appTest(path: string) { renderWithStore( @@ -19,10 +20,10 @@ function appTest(path: string) { ); } -// See jest/server-handlers.ts for test routes +// See vi/server-handlers.ts for test routes describe('AppRoute', () => { afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); test('renders Front component for ROOT path', async () => { diff --git a/packages/ui-components/src/Theme/index.ts b/packages/ui-components/src/Theme/index.ts index f15e21cfa..3e0c13d15 100644 --- a/packages/ui-components/src/Theme/index.ts +++ b/packages/ui-components/src/Theme/index.ts @@ -1,4 +1,4 @@ export * as colors from './colors'; export { ThemeProvider, useCustomTheme } from './ThemeProvider'; export { default as StyleBaseline } from './StyleBaseline'; -export { Theme, FontWeight } from './theme'; +export { Theme, FontWeight, getTheme } from './theme'; diff --git a/packages/ui-components/src/__mocks__/react-markdown.tsx b/packages/ui-components/src/__mocks__/react-markdown.tsx deleted file mode 100644 index 706e532d5..000000000 --- a/packages/ui-components/src/__mocks__/react-markdown.tsx +++ /dev/null @@ -1,8 +0,0 @@ -// eslint-disable -import React from 'react'; - -// @ts-ignore -export default function ({ children }) { - return <>{children}; -} -// eslint-enable diff --git a/packages/ui-components/src/__mocks__/remark-plugin.ts b/packages/ui-components/src/__mocks__/remark-plugin.ts deleted file mode 100644 index ea9b101e1..000000000 --- a/packages/ui-components/src/__mocks__/remark-plugin.ts +++ /dev/null @@ -1 +0,0 @@ -export default function () {} diff --git a/packages/ui-components/src/components/Author/Author.test.tsx b/packages/ui-components/src/components/Author/Author.test.tsx index 3594ca372..6116ecdda 100644 --- a/packages/ui-components/src/components/Author/Author.test.tsx +++ b/packages/ui-components/src/components/Author/Author.test.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { vi } from 'vitest'; import { cleanup, render, screen } from '../../test/test-react-testing-library'; import { PackageMetaInterface } from '../../types/packageMeta'; @@ -10,7 +11,7 @@ const withAuthorComponent = (packageMeta: PackageMetaInterface): JSX.Element => describe(' component', () => { beforeEach(() => { - jest.resetAllMocks(); + vi.resetAllMocks(); cleanup(); }); diff --git a/packages/ui-components/src/components/Author/__snapshots__/Author.test.tsx.snap b/packages/ui-components/src/components/Author/__snapshots__/Author.test.tsx.snap index 85e76061b..125047c55 100644 --- a/packages/ui-components/src/components/Author/__snapshots__/Author.test.tsx.snap +++ b/packages/ui-components/src/components/Author/__snapshots__/Author.test.tsx.snap @@ -1,157 +1,23 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[` component should render the component in default state 1`] = ` -{ +exports[` component > should render the component in default state 1`] = ` +Object { "asFragment": [Function], - "baseElement": .emotion-0 { - list-style: none; - margin: 0; - padding: 0; - position: relative; - padding-top: 0; - padding-bottom: 8px; -} - -.emotion-2 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 400; - font-size: 1rem; - line-height: 1.75; - font-weight: 700; -} - -.emotion-4 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - -webkit-justify-content: flex-start; - justify-content: flex-start; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - position: relative; - -webkit-text-decoration: none; - text-decoration: none; - width: 100%; - box-sizing: border-box; - text-align: left; - padding-top: 8px; - padding-bottom: 8px; - padding-left: 16px; - padding-right: 16px; - margin-top: 8px; - margin-bottom: 8px; - padding: 0; -} - -.emotion-4.Mui-focusVisible { - background-color: rgba(0, 0, 0, 0.12); -} - -.emotion-4.Mui-selected { - background-color: rgba(75, 94, 64, 0.08); -} - -.emotion-4.Mui-selected.Mui-focusVisible { - background-color: rgba(75, 94, 64, 0.2); -} - -.emotion-4.Mui-disabled { - opacity: 0.38; -} - -.emotion-4:hover { - background-color: transparent; -} - -.emotion-5 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 400; - font-size: 0.75rem; - line-height: 1.66; - color: #4b5e40; - -webkit-text-decoration: none; - text-decoration: none; -} - -.emotion-5:hover { - -webkit-text-decoration: underline; - text-decoration: underline; -} - -.emotion-6 { - position: relative; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - width: 40px; - height: 40px; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-size: 1.25rem; - line-height: 1; - border-radius: 50%; - overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - width: 40px; - height: 40px; - margin-left: 0px; - margin-right: 8px; -} - -.emotion-7 { - width: 100%; - height: 100%; - text-align: center; - object-fit: cover; - color: transparent; - text-indent: 10000px; -} - -.emotion-8 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 500; - font-size: 0.875rem; - line-height: 1.57; - margin-left: 8px; -} - - + "baseElement":
, - "container": .emotion-0 { - list-style: none; - margin: 0; - padding: 0; - position: relative; - padding-top: 0; - padding-bottom: 8px; -} - -.emotion-2 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 400; - font-size: 1rem; - line-height: 1.75; - font-weight: 700; -} - -.emotion-4 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - -webkit-justify-content: flex-start; - justify-content: flex-start; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - position: relative; - -webkit-text-decoration: none; - text-decoration: none; - width: 100%; - box-sizing: border-box; - text-align: left; - padding-top: 8px; - padding-bottom: 8px; - padding-left: 16px; - padding-right: 16px; - margin-top: 8px; - margin-bottom: 8px; - padding: 0; -} - -.emotion-4.Mui-focusVisible { - background-color: rgba(0, 0, 0, 0.12); -} - -.emotion-4.Mui-selected { - background-color: rgba(75, 94, 64, 0.08); -} - -.emotion-4.Mui-selected.Mui-focusVisible { - background-color: rgba(75, 94, 64, 0.2); -} - -.emotion-4.Mui-disabled { - opacity: 0.38; -} - -.emotion-4:hover { - background-color: transparent; -} - -.emotion-5 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 400; - font-size: 0.75rem; - line-height: 1.66; - color: #4b5e40; - -webkit-text-decoration: none; - text-decoration: none; -} - -.emotion-5:hover { - -webkit-text-decoration: underline; - text-decoration: underline; -} - -.emotion-6 { - position: relative; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - width: 40px; - height: 40px; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-size: 1.25rem; - line-height: 1; - border-radius: 50%; - overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - width: 40px; - height: 40px; - margin-left: 0px; - margin-right: 8px; -} - -.emotion-7 { - width: 100%; - height: 100%; - text-align: center; - object-fit: cover; - color: transparent; - text-indent: 10000px; -} - -.emotion-8 { - margin: 0; - font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif; - font-weight: 500; - font-size: 0.875rem; - line-height: 1.57; - margin-left: 8px; -} - -
+ "container":