1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-24 21:15:51 +01:00

final migration to vitest remove jest (#4978)

* migrate vitest ui-components

* migrate vitest ui-components

* fix e2e

* cleanup
This commit is contained in:
Juan Picado 2024-12-07 21:48:32 +01:00 committed by GitHub
parent ebede07eb9
commit 4f6609a072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
93 changed files with 1210 additions and 3998 deletions

@ -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 () => {

@ -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 () => {

@ -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 () => {

@ -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": {}
}
]

@ -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: ['<rootDir>/jest/setup-env.ts'],
setupFiles: ['<rootDir>/jest/setup.ts'],
transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-syntax-highlighter)'],
modulePathIgnorePatterns: [
'<rootDir>/coverage',
'<rootDir>/scripts',
'<rootDir>/.circleci',
'<rootDir>/tools',
'<rootDir>/build',
'<rootDir>/.vscode/',
'<rootDir>/test/e2e/',
],
snapshotSerializers: ['@emotion/jest/serializer'],
moduleNameMapper: {
'\\.(s?css)$': '<rootDir>/jest/identity.js',
'\\.(png)$': '<rootDir>/jest/identity.js',
'\\.(svg)$': '<rootDir>/jest/unit/empty.ts',
'\\.(jpg)$': '<rootDir>/jest/unit/empty.ts',
'\\.(md)$': '<rootDir>/jest/unit/empty-string.ts',
// note: this section has to be on sync with webpack configuration
'verdaccio-ui/components/(.*)': '<rootDir>/src/components/$1',
'verdaccio-ui/utils/(.*)': '<rootDir>/src/utils/$1',
'react-markdown': '<rootDir>/src/__mocks__/react-markdown.tsx',
'remark-*': '<rootDir>/src/__mocks__/remark-plugin.ts',
},
});

@ -1 +0,0 @@
jest.requireActual('babel/polyfill');

@ -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',
})
);
}
),
];

@ -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();
});

@ -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<unknown> {
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,
});
}
});
}

@ -1,7 +0,0 @@
/**
* Mock response for logo api
* @returns {promise}
*/
export default function <T>(): Promise<T> {
return Promise.resolve('http://localhost/-/static/logo.png');
}

@ -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'],
},
},
];

@ -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',
},
},
};

@ -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",

@ -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('<App />', () => {

@ -1,8 +0,0 @@
// eslint-disable
import React from 'react';
// @ts-ignore
export default function ({ children }) {
return <>{children}</>;
}
// eslint-enable

@ -1 +0,0 @@
export default function () {}

@ -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'),
},
},
});

@ -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();
}

@ -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();
}

@ -1,8 +1,16 @@
{
"extends": "../../.babelrc",
"plugins": ["@emotion"],
"sourceMaps" : "inline",
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"esmodules": true
}
}
],
"@babel/preset-react"
]
}

@ -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

@ -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;

@ -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: ['<rootDir>/jest/setup-env.ts'],
setupFiles: ['<rootDir>/jest/setup.ts'],
transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-syntax-highlighter)'],
snapshotSerializers: ['@emotion/jest/serializer'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!**/node_modules/**',
'!src/**/*.stories.{ts,tsx}',
'!src/types/**',
],
modulePathIgnorePatterns: ['<rootDir>/build/'],
moduleNameMapper: {
'\\.(s?css)$': '<rootDir>/jest/identity.js',
'\\.(png)$': '<rootDir>/jest/identity.js',
'\\.(svg)$': '<rootDir>/jest/unit/empty.ts',
'\\.(jpg)$': '<rootDir>/jest/unit/empty.ts',
'\\.(md)$': '<rootDir>/jest/unit/empty-string.ts',
'react-markdown': '<rootDir>/src/__mocks__/react-markdown.tsx',
'remark-*': '<rootDir>/src/__mocks__/remark-plugin.ts',
},
coverageReporters: ['text', 'html'],
coverageThreshold: {
global: {
branches: 70,
functions: 75,
lines: 80,
statements: 81,
},
},
});

@ -1 +0,0 @@
jest.requireActual('babel/polyfill');

@ -1,6 +0,0 @@
import { setupServer } from 'msw/node';
import { handlers } from './server-handlers';
const server = setupServer(...handlers);
export { server };

@ -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();
});

@ -1 +0,0 @@
export default 'empty string module';

@ -1 +0,0 @@
export default {};

@ -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",

@ -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 () => {

@ -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';

@ -1,8 +0,0 @@
// eslint-disable
import React from 'react';
// @ts-ignore
export default function ({ children }) {
return <>{children}</>;
}
// eslint-enable

@ -1 +0,0 @@
export default function () {}

@ -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('<Author /> component', () => {
beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();
cleanup();
});

@ -1,157 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Author /> component should render the component in default state 1`] = `
{
exports[`<Author /> 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;
}
<body>
"baseElement": <body>
<div>
<ul
class="MuiList-root MuiList-padding MuiList-subheader emotion-0"
class="MuiList-root MuiList-padding MuiList-subheader makeStyles-MuiList-root"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-1 emotion-2"
class="MuiTypography-root MuiTypography-subtitle1 e4ifo371 makeStyles-MuiTypography-root-StyledText"
>
sidebar.author.title
</h6>
<li
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding emotion-3 emotion-4"
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding e4ifo370 makeStyles-MuiListItem-root-AuthorListItem"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-5"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="verdaccio user"
href="mailto:verdaccio.user@verdaccio.org?subject=verdaccio v4.0.0"
@ -159,17 +25,17 @@ exports[`<Author /> component should render the component in default state 1`] =
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular emotion-6"
class="MuiAvatar-root MuiAvatar-circular makeStyles-MuiAvatar-root"
>
<img
alt="verdaccio user"
class="MuiAvatar-img emotion-7"
class="MuiAvatar-img makeStyles-MuiAvatar-img"
src="https://www.gravatar.com/avatar/000000"
/>
</div>
</a>
<h6
class="MuiTypography-root MuiTypography-subtitle2 emotion-8"
class="MuiTypography-root MuiTypography-subtitle2 makeStyles-MuiTypography-root"
>
verdaccio user
</h6>
@ -177,154 +43,20 @@ exports[`<Author /> component should render the component in default state 1`] =
</ul>
</div>
</body>,
"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;
}
<div>
"container": <div>
<ul
class="MuiList-root MuiList-padding MuiList-subheader emotion-0"
class="MuiList-root MuiList-padding MuiList-subheader makeStyles-MuiList-root"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-1 emotion-2"
class="MuiTypography-root MuiTypography-subtitle1 e4ifo371 makeStyles-MuiTypography-root-StyledText"
>
sidebar.author.title
</h6>
<li
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding emotion-3 emotion-4"
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding e4ifo370 makeStyles-MuiListItem-root-AuthorListItem"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-5"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="verdaccio user"
href="mailto:verdaccio.user@verdaccio.org?subject=verdaccio v4.0.0"
@ -332,17 +64,17 @@ exports[`<Author /> component should render the component in default state 1`] =
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular emotion-6"
class="MuiAvatar-root MuiAvatar-circular makeStyles-MuiAvatar-root"
>
<img
alt="verdaccio user"
class="MuiAvatar-img emotion-7"
class="MuiAvatar-img makeStyles-MuiAvatar-img"
src="https://www.gravatar.com/avatar/000000"
/>
</div>
</a>
<h6
class="MuiTypography-root MuiTypography-subtitle2 emotion-8"
class="MuiTypography-root MuiTypography-subtitle2 makeStyles-MuiTypography-root"
>
verdaccio user
</h6>
@ -403,153 +135,35 @@ exports[`<Author /> component should render the component in default state 1`] =
}
`;
exports[`<Author /> component should render the component when there is no author email 1`] = `
{
exports[`<Author /> component > should render the component when there is no author email 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 {
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-6 {
width: 100%;
height: 100%;
text-align: center;
object-fit: cover;
color: transparent;
text-indent: 10000px;
}
.emotion-7 {
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;
}
<body>
"baseElement": <body>
<div>
<ul
class="MuiList-root MuiList-padding MuiList-subheader emotion-0"
class="MuiList-root MuiList-padding MuiList-subheader makeStyles-MuiList-root"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-1 emotion-2"
class="MuiTypography-root MuiTypography-subtitle1 e4ifo371 makeStyles-MuiTypography-root-StyledText"
>
sidebar.author.title
</h6>
<li
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding emotion-3 emotion-4"
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding e4ifo370 makeStyles-MuiListItem-root-AuthorListItem"
>
<div
class="MuiAvatar-root MuiAvatar-circular emotion-5"
class="MuiAvatar-root MuiAvatar-circular makeStyles-MuiAvatar-root"
data-mui-internal-clone-element="true"
data-testid="verdaccio user"
>
<img
alt="verdaccio user"
class="MuiAvatar-img emotion-6"
class="MuiAvatar-img makeStyles-MuiAvatar-img"
src="https://www.gravatar.com/avatar/000000"
/>
</div>
<h6
class="MuiTypography-root MuiTypography-subtitle2 emotion-7"
class="MuiTypography-root MuiTypography-subtitle2 makeStyles-MuiTypography-root"
>
verdaccio user
</h6>
@ -557,149 +171,31 @@ exports[`<Author /> component should render the component when there is no autho
</ul>
</div>
</body>,
"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 {
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-6 {
width: 100%;
height: 100%;
text-align: center;
object-fit: cover;
color: transparent;
text-indent: 10000px;
}
.emotion-7 {
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;
}
<div>
"container": <div>
<ul
class="MuiList-root MuiList-padding MuiList-subheader emotion-0"
class="MuiList-root MuiList-padding MuiList-subheader makeStyles-MuiList-root"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-1 emotion-2"
class="MuiTypography-root MuiTypography-subtitle1 e4ifo371 makeStyles-MuiTypography-root-StyledText"
>
sidebar.author.title
</h6>
<li
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding emotion-3 emotion-4"
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding e4ifo370 makeStyles-MuiListItem-root-AuthorListItem"
>
<div
class="MuiAvatar-root MuiAvatar-circular emotion-5"
class="MuiAvatar-root MuiAvatar-circular makeStyles-MuiAvatar-root"
data-mui-internal-clone-element="true"
data-testid="verdaccio user"
>
<img
alt="verdaccio user"
class="MuiAvatar-img emotion-6"
class="MuiAvatar-img makeStyles-MuiAvatar-img"
src="https://www.gravatar.com/avatar/000000"
/>
</div>
<h6
class="MuiTypography-root MuiTypography-subtitle2 emotion-7"
class="MuiTypography-root MuiTypography-subtitle2 makeStyles-MuiTypography-root"
>
verdaccio user
</h6>

@ -1,10 +1,11 @@
import React from 'react';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import CopyToClipBoard from './CopyToClipBoard';
Object.assign(navigator, {
clipboard: { writeText: jest.fn().mockImplementation(() => Promise.resolve()) },
clipboard: { writeText: vi.fn().mockImplementation(() => Promise.resolve()) },
});
describe('CopyToClipBoard component', () => {

@ -1,9 +1,16 @@
import React from 'react';
import { HashRouter } from 'react-router-dom';
import { vi } from 'vitest';
import { render, screen } from '../../test/test-react-testing-library';
import Dependencies from './Dependencies';
const replaceMock = vi.fn(() => []);
Object.defineProperty(window, 'location', {
writable: true,
value: { ...window.location, replace: replaceMock, href: '' },
});
describe('<Dependencies /> component', () => {
test('Renders a message when there are no dependencies', () => {
const packageMeta = {

@ -1,12 +1,13 @@
import React from 'react';
import { MemoryRouter, Route } from 'react-router';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import { DependencyBlock } from './DependencyBlock';
const mockHistory = jest.fn();
const mockHistory = vi.fn();
jest.mock('react-router-dom', () => ({
vi.mock('react-router-dom', () => ({
useHistory: () => ({
push: mockHistory,
}),

@ -1,117 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`test Developers should render the component for contributors with items 1`] = `
{
exports[`test Developers > should render the component for contributors with items 1`] = `
Object {
"asFragment": [Function],
"baseElement": .emotion-1 {
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;
margin-bottom: 10px;
}
.emotion-3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 10px 0 10px 0;
}
.emotion-3>* {
margin-right: 5px;
}
.emotion-4 {
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-4:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-5 {
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;
color: #f4f4f4;
background-color: #bdbdbd;
width: 40px;
height: 40px;
margin-left: 0px;
margin-right: 8px;
}
.emotion-6 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: 1.5rem;
width: 75%;
height: 75%;
}
<body>
"baseElement": <body>
<div>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-0 emotion-1"
class="MuiTypography-root MuiTypography-subtitle1 e1ssrjap0 makeStyles-MuiTypography-root-StyledText"
>
sidebar.contributors.title
</h6>
<div
class="emotion-2 MuiBox-root emotion-3"
class="eoc81fk0 MuiBox-root makeStyles-StyledBox"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="dmethvin"
href="mailto:test@gmail.com?subject=undefined v1.0.0"
@ -119,11 +22,11 @@ exports[`test Developers should render the component for contributors with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -135,7 +38,7 @@ exports[`test Developers should render the component for contributors with items
</div>
</a>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="mgol"
href="mailto:m.goleb@gmail.com?subject=undefined v1.0.0"
@ -143,11 +46,11 @@ exports[`test Developers should render the component for contributors with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -161,114 +64,17 @@ exports[`test Developers should render the component for contributors with items
</div>
</div>
</body>,
"container": .emotion-1 {
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;
margin-bottom: 10px;
}
.emotion-3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 10px 0 10px 0;
}
.emotion-3>* {
margin-right: 5px;
}
.emotion-4 {
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-4:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-5 {
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;
color: #f4f4f4;
background-color: #bdbdbd;
width: 40px;
height: 40px;
margin-left: 0px;
margin-right: 8px;
}
.emotion-6 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: 1.5rem;
width: 75%;
height: 75%;
}
<div>
"container": <div>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-0 emotion-1"
class="MuiTypography-root MuiTypography-subtitle1 e1ssrjap0 makeStyles-MuiTypography-root-StyledText"
>
sidebar.contributors.title
</h6>
<div
class="emotion-2 MuiBox-root emotion-3"
class="eoc81fk0 MuiBox-root makeStyles-StyledBox"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="dmethvin"
href="mailto:test@gmail.com?subject=undefined v1.0.0"
@ -276,11 +82,11 @@ exports[`test Developers should render the component for contributors with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -292,7 +98,7 @@ exports[`test Developers should render the component for contributors with items
</div>
</a>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="mgol"
href="mailto:m.goleb@gmail.com?subject=undefined v1.0.0"
@ -300,11 +106,11 @@ exports[`test Developers should render the component for contributors with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -371,118 +177,21 @@ exports[`test Developers should render the component for contributors with items
}
`;
exports[`test Developers should render the component for maintainers with items 1`] = `
{
exports[`test Developers > should render the component for maintainers with items 1`] = `
Object {
"asFragment": [Function],
"baseElement": .emotion-1 {
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;
margin-bottom: 10px;
}
.emotion-3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 10px 0 10px 0;
}
.emotion-3>* {
margin-right: 5px;
}
.emotion-4 {
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-4:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-5 {
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;
color: #f4f4f4;
background-color: #bdbdbd;
width: 40px;
height: 40px;
margin-left: 0px;
margin-right: 8px;
}
.emotion-6 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: 1.5rem;
width: 75%;
height: 75%;
}
<body>
"baseElement": <body>
<div>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-0 emotion-1"
class="MuiTypography-root MuiTypography-subtitle1 e1ssrjap0 makeStyles-MuiTypography-root-StyledText"
>
sidebar.maintainers.title
</h6>
<div
class="emotion-2 MuiBox-root emotion-3"
class="eoc81fk0 MuiBox-root makeStyles-StyledBox"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="dmethvin"
href="mailto:test@gmail.com?subject=undefined v1.0.0"
@ -490,11 +199,11 @@ exports[`test Developers should render the component for maintainers with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -506,7 +215,7 @@ exports[`test Developers should render the component for maintainers with items
</div>
</a>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="mgol"
href="mailto:m.goleb@gmail.com?subject=undefined v1.0.0"
@ -514,11 +223,11 @@ exports[`test Developers should render the component for maintainers with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -532,114 +241,17 @@ exports[`test Developers should render the component for maintainers with items
</div>
</div>
</body>,
"container": .emotion-1 {
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;
margin-bottom: 10px;
}
.emotion-3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 10px 0 10px 0;
}
.emotion-3>* {
margin-right: 5px;
}
.emotion-4 {
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-4:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-5 {
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;
color: #f4f4f4;
background-color: #bdbdbd;
width: 40px;
height: 40px;
margin-left: 0px;
margin-right: 8px;
}
.emotion-6 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: 1.5rem;
width: 75%;
height: 75%;
}
<div>
"container": <div>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-0 emotion-1"
class="MuiTypography-root MuiTypography-subtitle1 e1ssrjap0 makeStyles-MuiTypography-root-StyledText"
>
sidebar.maintainers.title
</h6>
<div
class="emotion-2 MuiBox-root emotion-3"
class="eoc81fk0 MuiBox-root makeStyles-StyledBox"
>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="dmethvin"
href="mailto:test@gmail.com?subject=undefined v1.0.0"
@ -647,11 +259,11 @@ exports[`test Developers should render the component for maintainers with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -663,7 +275,7 @@ exports[`test Developers should render the component for maintainers with items
</div>
</a>
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-4"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
data-mui-internal-clone-element="true"
data-testid="mgol"
href="mailto:m.goleb@gmail.com?subject=undefined v1.0.0"
@ -671,11 +283,11 @@ exports[`test Developers should render the component for maintainers with items
target="_blank"
>
<div
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault emotion-5"
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault makeStyles-MuiAvatar-root"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback emotion-6"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback makeStyles-MuiSvgIcon-root-MuiAvatar-fallback"
data-testid="PersonIcon"
focusable="false"
viewBox="0 0 24 24"
@ -742,8 +354,8 @@ exports[`test Developers should render the component for maintainers with items
}
`;
exports[`test Developers should render the component with no items 1`] = `
{
exports[`test Developers > should render the component with no items 1`] = `
Object {
"asFragment": [Function],
"baseElement": <body>
<div />

@ -1,11 +1,12 @@
import React from 'react';
import { vi } from 'vitest';
import { cleanup, render } from '../../test/test-react-testing-library';
import { PackageMetaInterface } from '../../types/packageMeta';
import Engine from './Engines';
jest.mock('./img/node.png', () => '');
jest.mock('../Install/img/npm.svg', () => '');
vi.mock('./img/node.png', () => '');
vi.mock('../Install/img/npm.svg', () => '');
const mockPackageMeta = (
engines?: PackageMetaInterface['latest']['engines']

@ -1,4 +1,5 @@
import React from 'react';
import { vi } from 'vitest';
import { render, screen } from '../../test/test-react-testing-library';
import ErrorBoundary from './ErrorBoundary';
@ -20,7 +21,7 @@ describe('ErrorBoundary component', () => {
};
// Suppress error messages for this test
const spy = jest.spyOn(console, 'error');
const spy = vi.spyOn(console, 'error');
spy.mockImplementation(() => {});
render(

@ -1,12 +1,13 @@
import React from 'react';
import { MemoryRouter } from 'react-router';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import Forbidden from './Forbidden';
const mockHistory = jest.fn();
const mockHistory = vi.fn();
jest.mock('react-router-dom', () => ({
vi.mock('react-router-dom', () => ({
useHistory: () => ({
push: mockHistory,
}),

@ -1,10 +1,11 @@
import React from 'react';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import HeaderInfoDialog from './HeaderInfoDialog';
describe('HeaderInfoDialog', () => {
const onCloseDialog = jest.fn();
const onCloseDialog = vi.fn();
const tabs = [{ label: 'Tab 1' }, { label: 'Tab 2' }];

@ -1,13 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Label /> component should render the component in default state 1`] = `
.emotion-0 {
font-weight: 400;
text-transform: none;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Label /> component > should render the component in default state 1`] = `
<div
class="emotion-0 emotion-1"
class="makeStyles-Wrapper erabg9d0"
>
test
</div>

@ -1,61 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Link /> component should render the component in default state 1`] = `
.emotion-0 {
-webkit-text-decoration: none;
text-decoration: none;
}
.emotion-0:hover,
.emotion-0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-2 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.5;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Link /> component > should render the component in default state 1`] = `
<a
class="emotion-0 emotion-1"
class="makeStyles-CustomRouterLink e2ct7p50"
href="/"
>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 makeStyles-MuiTypography-root"
/>
</a>
`;
exports[`<Link /> component should render the component with link 1`] = `
.emotion-0 {
-webkit-text-decoration: none;
text-decoration: none;
}
.emotion-0:hover,
.emotion-0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-2 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.5;
}
exports[`<Link /> component > should render the component with link 1`] = `
<a
class="emotion-0 emotion-1"
class="makeStyles-CustomRouterLink e2ct7p50"
href="/"
>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 makeStyles-MuiTypography-root"
>
Home
</p>

@ -1,49 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<LinkExternal /> component should render the component in default state 1`] = `
.emotion-0 {
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-0:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<LinkExternal /> component > should render the component in default state 1`] = `
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-0"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
href="/"
rel="noopener noreferrer"
target="_blank"
/>
`;
exports[`<LinkExternal /> component should render the component with external link 1`] = `
.emotion-0 {
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-0:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
exports[`<LinkExternal /> component > should render the component with external link 1`] = `
<a
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover emotion-0"
class="MuiTypography-root MuiTypography-caption MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
href="https://example.com"
rel="noopener noreferrer"
target="_blank"

@ -1,92 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Spinner /> component should render the component in default state 1`] = `
{
exports[`<Spinner /> component > should render the component in default state 1`] = `
Object {
"asFragment": [Function],
"baseElement": @keyframes animation-0 {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes animation-1 {
0% {
stroke-dasharray: 1px,200px;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100px,200px;
stroke-dashoffset: -15px;
}
100% {
stroke-dasharray: 100px,200px;
stroke-dashoffset: -125px;
}
}
.emotion-0 {
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;
}
.emotion-3 {
display: inline-block;
color: #4b5e40;
-webkit-animation: animation-0 1.4s linear infinite;
animation: animation-0 1.4s linear infinite;
color: #4b5e40;
}
.emotion-4 {
display: block;
}
.emotion-5 {
stroke: currentColor;
stroke-dasharray: 80px,200px;
stroke-dashoffset: 0;
-webkit-animation: animation-1 1.4s ease-in-out infinite;
animation: animation-1 1.4s ease-in-out infinite;
}
<body>
"baseElement": <body>
<div>
<div
class="emotion-0 emotion-1"
class="makeStyles-Wrapper eapffsy1"
>
<span
class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary emotion-2 emotion-3"
class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary eapffsy0 makeStyles-MuiCircularProgress-root-Circular"
role="progressbar"
style="width: 50px; height: 50px;"
>
<svg
class="MuiCircularProgress-svg emotion-4"
class="MuiCircularProgress-svg makeStyles-MuiCircularProgress-svg"
viewBox="22 22 44 44"
>
<circle
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate emotion-5"
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate makeStyles-MuiCircularProgress-circle"
cx="44"
cy="44"
fill="none"
@ -98,89 +30,21 @@ exports[`<Spinner /> component should render the component in default state 1`]
</div>
</div>
</body>,
"container": @keyframes animation-0 {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes animation-1 {
0% {
stroke-dasharray: 1px,200px;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100px,200px;
stroke-dashoffset: -15px;
}
100% {
stroke-dasharray: 100px,200px;
stroke-dashoffset: -125px;
}
}
.emotion-0 {
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;
}
.emotion-3 {
display: inline-block;
color: #4b5e40;
-webkit-animation: animation-0 1.4s linear infinite;
animation: animation-0 1.4s linear infinite;
color: #4b5e40;
}
.emotion-4 {
display: block;
}
.emotion-5 {
stroke: currentColor;
stroke-dasharray: 80px,200px;
stroke-dashoffset: 0;
-webkit-animation: animation-1 1.4s ease-in-out infinite;
animation: animation-1 1.4s ease-in-out infinite;
}
<div>
"container": <div>
<div
class="emotion-0 emotion-1"
class="makeStyles-Wrapper eapffsy1"
>
<span
class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary emotion-2 emotion-3"
class="MuiCircularProgress-root MuiCircularProgress-indeterminate MuiCircularProgress-colorPrimary eapffsy0 makeStyles-MuiCircularProgress-root-Circular"
role="progressbar"
style="width: 50px; height: 50px;"
>
<svg
class="MuiCircularProgress-svg emotion-4"
class="MuiCircularProgress-svg makeStyles-MuiCircularProgress-svg"
viewBox="22 22 44 44"
>
<circle
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate emotion-5"
class="MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate makeStyles-MuiCircularProgress-circle"
cx="44"
cy="44"
fill="none"

@ -1,4 +1,5 @@
import React from 'react';
import { vi } from 'vitest';
import { api, store } from '../../';
import {
@ -13,14 +14,14 @@ import LoginDialog from './LoginDialog';
describe('<LoginDialog /> component', () => {
beforeEach(() => {
jest.resetModules();
jest.resetAllMocks();
vi.resetModules();
vi.resetAllMocks();
cleanup();
});
test('should render the component in default state', () => {
const props = {
onClose: jest.fn(),
onClose: vi.fn(),
};
const { container } = renderWithStore(<LoginDialog onClose={props.onClose} />, store);
expect(container.firstChild).toMatchSnapshot();
@ -29,7 +30,7 @@ describe('<LoginDialog /> component', () => {
test('should load the component with the open prop', async () => {
const props = {
open: true,
onClose: jest.fn(),
onClose: vi.fn(),
};
const { getByTestId } = renderWithStore(
@ -44,7 +45,7 @@ describe('<LoginDialog /> component', () => {
test('onClose: should close the login modal', async () => {
const props = {
open: true,
onClose: jest.fn(),
onClose: vi.fn(),
};
const { getByTestId } = renderWithStore(
@ -65,10 +66,10 @@ describe('<LoginDialog /> component', () => {
test('setCredentials - should set username and password in state', async () => {
const props = {
open: true,
onClose: jest.fn(),
onClose: vi.fn(),
};
jest.spyOn(api, 'request').mockImplementation(() =>
vi.spyOn(api, 'request').mockImplementation(() =>
Promise.resolve({
username: 'xyz',
token: 'djsadaskljd',

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<LoginDialog /> component should render the component in default state 1`] = `null`;
exports[`<LoginDialog /> component > should render the component in default state 1`] = `null`;

@ -1,22 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Logo /> component should render the component in default state 1`] = `
.emotion-0 {
display: inline-block;
vertical-align: middle;
box-sizing: border-box;
-webkit-background-position: center;
background-position: center;
-webkit-background-size: contain;
background-size: contain;
background-image: url([object Object]);
background-repeat: no-repeat;
width: 40px;
height: 40px;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Logo /> component > should render the component in default state 1`] = `
<div
class="emotion-0 emotion-1"
class="makeStyles-StyledLogo exban010"
data-testid="default-logo"
title=""
/>

@ -1,84 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<NoItem /> component should load the component in default state 1`] = `
.emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: none;
background-image: unset;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
background-color: transparent;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding: 6px 16px;
color: rgb(1, 67, 97);
background-color: rgb(229, 246, 253);
}
.emotion-0 .MuiAlert-icon {
color: #0288d1;
}
.emotion-1 {
margin-right: 12px;
padding: 7px 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
font-size: 22px;
opacity: 0.9;
}
.emotion-2 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: inherit;
}
.emotion-3 {
padding: 8px 0;
min-width: 0;
overflow: auto;
}
.emotion-4 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.5;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<NoItem /> component > should load the component in default state 1`] = `
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard makeStyles-MuiPaper-root-MuiAlert-root"
role="alert"
>
<div
class="MuiAlert-icon emotion-1"
class="MuiAlert-icon makeStyles-MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit emotion-2"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit makeStyles-MuiSvgIcon-root"
data-testid="InfoOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
@ -89,10 +21,10 @@ exports[`<NoItem /> component should load the component in default state 1`] = `
</svg>
</div>
<div
class="MuiAlert-message emotion-3"
class="MuiAlert-message makeStyles-MuiAlert-message"
>
<p
class="MuiTypography-root MuiTypography-body1 emotion-4"
class="MuiTypography-root MuiTypography-body1 makeStyles-MuiTypography-root"
>
test
</p>

@ -1,12 +1,13 @@
import React from 'react';
import { MemoryRouter } from 'react-router';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import NotFound from './NotFound';
const mockHistory = jest.fn();
const mockHistory = vi.fn();
jest.mock('react-router-dom', () => ({
vi.mock('react-router-dom', () => ({
useHistory: () => ({
push: mockHistory,
}),

@ -1,5 +1,6 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { vi } from 'vitest';
import { store } from '../../store';
import { cleanup, renderWithStore } from '../../test/test-react-testing-library';
@ -18,7 +19,7 @@ describe('<PackageList /> component', () => {
test('should load the component with packages', () => {
// Mock <Autosizer /> width
jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
const props = {
packages: [

@ -1,54 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Readme /> component should load the component in default state 1`] = `
{
exports[`<Readme /> component > should load the component in default state 1`] = `
Object {
"asFragment": [Function],
"baseElement": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
margin: 16px;
}
.emotion-3 ul {
list-style: disc;
}
.emotion-3 img {
max-width: 100%;
}
<body>
"baseElement": <body>
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiBox-root emotion-2"
class="MuiBox-root"
data-testid="readme"
>
<div
class="markdown-body markdown-light emotion-3 emotion-4"
class="markdown-body markdown-light makeStyles-Wrapper e1gao54u0"
>
<p>
test
@ -61,51 +29,19 @@ exports[`<Readme /> component should load the component in default state 1`] = `
</div>
</div>
</body>,
"container": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
margin: 16px;
}
.emotion-3 ul {
list-style: disc;
}
.emotion-3 img {
max-width: 100%;
}
<div>
"container": <div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiBox-root emotion-2"
class="MuiBox-root"
data-testid="readme"
>
<div
class="markdown-body markdown-light emotion-3 emotion-4"
class="markdown-body markdown-light makeStyles-Wrapper e1gao54u0"
>
<p>
test

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Repository /> component should load the component in default state 1`] = `null`;
exports[`<Repository /> component > should load the component in default state 1`] = `null`;

@ -1,17 +1,18 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { vi } from 'vitest';
import { api, store } from '../../';
import { fireEvent, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
import Search from './Search';
import { cleanDescription } from './utils';
jest.mock('lodash/debounce', () =>
jest.fn((fn) => {
fn.cancel = jest.fn();
return fn;
})
);
vi.mock('lodash/debounce', () => ({
default: vi.fn((fn) => {
// Immediately execute the function for testing
return (...args: any[]) => fn(...args);
}),
}));
/* eslint-disable verdaccio/jsx-spread */
const ComponentToBeRendered: React.FC = () => (
@ -22,7 +23,7 @@ const ComponentToBeRendered: React.FC = () => (
describe('<Search /> component', () => {
beforeEach(() => {
jest.spyOn(api, 'request').mockImplementation(() =>
vi.spyOn(api, 'request').mockImplementation(() =>
Promise.resolve([
{
name: 'verdaccio-ui/types',
@ -37,7 +38,7 @@ describe('<Search /> component', () => {
});
afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});
test('should load the component in default state', () => {

@ -1,217 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<TextField /> component should load the component in default state 1`] = `
.emotion-0 {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
min-width: 0;
padding: 0;
margin: 0;
border: 0;
vertical-align: top;
}
.emotion-1 {
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.4375em;
color: rgba(0, 0, 0, 0.87);
box-sizing: border-box;
position: relative;
cursor: text;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
position: relative;
border-radius: 4px;
}
.emotion-1.Mui-disabled {
color: rgba(0, 0, 0, 0.38);
cursor: default;
}
.emotion-1:hover .MuiOutlinedInput-notchedOutline {
border-color: rgba(0, 0, 0, 0.87);
}
@media (hover: none) {
.emotion-1:hover .MuiOutlinedInput-notchedOutline {
border-color: rgba(0, 0, 0, 0.23);
}
}
.emotion-1.Mui-focused .MuiOutlinedInput-notchedOutline {
border-color: #4b5e40;
border-width: 2px;
}
.emotion-1.Mui-error .MuiOutlinedInput-notchedOutline {
border-color: #d32f2f;
}
.emotion-1.Mui-disabled .MuiOutlinedInput-notchedOutline {
border-color: rgba(0, 0, 0, 0.26);
}
.emotion-2 {
font: inherit;
letter-spacing: inherit;
color: currentColor;
padding: 4px 0 5px;
border: 0;
box-sizing: content-box;
background: none;
height: 1.4375em;
margin: 0;
-webkit-tap-highlight-color: transparent;
display: block;
min-width: 0;
width: 100%;
-webkit-animation-name: mui-auto-fill-cancel;
animation-name: mui-auto-fill-cancel;
-webkit-animation-duration: 10ms;
animation-duration: 10ms;
padding: 16.5px 14px;
}
.emotion-2::-webkit-input-placeholder {
color: currentColor;
opacity: 0.42;
-webkit-transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}
.emotion-2::-moz-placeholder {
color: currentColor;
opacity: 0.42;
-webkit-transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}
.emotion-2:-ms-input-placeholder {
color: currentColor;
opacity: 0.42;
-webkit-transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}
.emotion-2::-ms-input-placeholder {
color: currentColor;
opacity: 0.42;
-webkit-transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}
.emotion-2:focus {
outline: 0;
}
.emotion-2:invalid {
box-shadow: none;
}
.emotion-2::-webkit-search-decoration {
-webkit-appearance: none;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2::-webkit-input-placeholder {
opacity: 0!important;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2::-moz-placeholder {
opacity: 0!important;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:-ms-input-placeholder {
opacity: 0!important;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2::-ms-input-placeholder {
opacity: 0!important;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:focus::-webkit-input-placeholder {
opacity: 0.42;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:focus::-moz-placeholder {
opacity: 0.42;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:focus:-ms-input-placeholder {
opacity: 0.42;
}
label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:focus::-ms-input-placeholder {
opacity: 0.42;
}
.emotion-2.Mui-disabled {
opacity: 1;
-webkit-text-fill-color: rgba(0, 0, 0, 0.38);
}
.emotion-2:-webkit-autofill {
-webkit-animation-duration: 5000s;
animation-duration: 5000s;
-webkit-animation-name: mui-auto-fill;
animation-name: mui-auto-fill;
}
.emotion-2:-webkit-autofill {
border-radius: inherit;
}
.emotion-3 {
text-align: left;
position: absolute;
bottom: 0;
right: 0;
top: -5px;
left: 0;
margin: 0;
padding: 0 8px;
pointer-events: none;
border-radius: inherit;
border-style: solid;
border-width: 1px;
overflow: hidden;
min-width: 0%;
border-color: rgba(0, 0, 0, 0.23);
}
.emotion-4 {
float: unset;
width: auto;
overflow: hidden;
padding: 0;
line-height: 11px;
-webkit-transition: width 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
transition: width 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<TextField /> component > should load the component in default state 1`] = `
<div
class="MuiFormControl-root MuiTextField-root emotion-0"
class="MuiFormControl-root MuiTextField-root makeStyles-MuiFormControl-root-MuiTextField-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-formControl emotion-1"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-formControl makeStyles-MuiInputBase-root-MuiOutlinedInput-root"
>
<input
aria-invalid="false"
class="MuiInputBase-input MuiOutlinedInput-input emotion-2"
class="MuiInputBase-input MuiOutlinedInput-input makeStyles-MuiInputBase-input-MuiOutlinedInput-input"
id=":r0:"
name="test"
type="text"
@ -219,11 +17,9 @@ label[data-shrink=false]+.MuiInputBase-formControl .emotion-2:focus::-ms-input-p
/>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline emotion-3"
class="MuiOutlinedInput-notchedOutline makeStyles-MuiOutlinedInput-notchedOutline"
>
<legend
class="emotion-4"
>
<legend>
<span
class="notranslate"
>

@ -1,114 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `
{
exports[`<UpLinks /> component > should render the component when there is no uplink 1`] = `
Object {
"asFragment": [Function],
"baseElement": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: none;
background-image: unset;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
background-color: transparent;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding: 6px 16px;
color: rgb(1, 67, 97);
background-color: rgb(229, 246, 253);
}
.emotion-2 .MuiAlert-icon {
color: #0288d1;
}
.emotion-3 {
margin-right: 12px;
padding: 7px 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
font-size: 22px;
opacity: 0.9;
}
.emotion-4 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: inherit;
}
.emotion-5 {
padding: 8px 0;
min-width: 0;
overflow: auto;
}
.emotion-6 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.5;
}
<body>
"baseElement": <body>
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard emotion-2"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard makeStyles-MuiPaper-root-MuiAlert-root"
role="alert"
>
<div
class="MuiAlert-icon emotion-3"
class="MuiAlert-icon makeStyles-MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit emotion-4"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit makeStyles-MuiSvgIcon-root"
data-testid="InfoOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
@ -119,10 +31,10 @@ exports[`<UpLinks /> component should render the component when there is no upli
</svg>
</div>
<div
class="MuiAlert-message emotion-5"
class="MuiAlert-message makeStyles-MuiAlert-message"
>
<p
class="MuiTypography-root MuiTypography-body1 emotion-6"
class="MuiTypography-root MuiTypography-body1 makeStyles-MuiTypography-root"
data-testid="no-uplinks"
>
uplinks.no-items
@ -133,111 +45,23 @@ exports[`<UpLinks /> component should render the component when there is no upli
</div>
</div>
</body>,
"container": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: none;
background-image: unset;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
background-color: transparent;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding: 6px 16px;
color: rgb(1, 67, 97);
background-color: rgb(229, 246, 253);
}
.emotion-2 .MuiAlert-icon {
color: #0288d1;
}
.emotion-3 {
margin-right: 12px;
padding: 7px 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
font-size: 22px;
opacity: 0.9;
}
.emotion-4 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 1em;
height: 1em;
display: inline-block;
fill: currentColor;
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
font-size: inherit;
}
.emotion-5 {
padding: 8px 0;
min-width: 0;
overflow: auto;
}
.emotion-6 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
line-height: 1.5;
}
<div>
"container": <div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard emotion-2"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard makeStyles-MuiPaper-root-MuiAlert-root"
role="alert"
>
<div
class="MuiAlert-icon emotion-3"
class="MuiAlert-icon makeStyles-MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit emotion-4"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit makeStyles-MuiSvgIcon-root"
data-testid="InfoOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
@ -248,10 +72,10 @@ exports[`<UpLinks /> component should render the component when there is no upli
</svg>
</div>
<div
class="MuiAlert-message emotion-5"
class="MuiAlert-message makeStyles-MuiAlert-message"
>
<p
class="MuiTypography-root MuiTypography-body1 emotion-6"
class="MuiTypography-root MuiTypography-body1 makeStyles-MuiTypography-root"
data-testid="no-uplinks"
>
uplinks.no-items
@ -315,170 +139,41 @@ exports[`<UpLinks /> component should render the component when there is no upli
}
`;
exports[`<UpLinks /> component should render the component with uplinks 1`] = `
{
exports[`<UpLinks /> component > should render the component with uplinks 1`] = `
Object {
"asFragment": [Function],
"baseElement": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
margin: 16px;
}
.emotion-4 {
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-5 {
list-style: none;
margin: 0;
padding: 0;
position: relative;
padding-top: 8px;
padding-bottom: 8px;
}
.emotion-6 {
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: 4px;
padding-bottom: 4px;
padding-left: 16px;
padding-right: 16px;
padding-right: 0px;
}
.emotion-6.Mui-focusVisible {
background-color: rgba(0, 0, 0, 0.12);
}
.emotion-6.Mui-selected {
background-color: rgba(75, 94, 64, 0.08);
}
.emotion-6.Mui-selected.Mui-focusVisible {
background-color: rgba(75, 94, 64, 0.2);
}
.emotion-6.Mui-disabled {
opacity: 0.38;
}
.emotion-8 {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-width: 0;
margin-top: 4px;
margin-bottom: 4px;
-webkit-flex: none;
-ms-flex: none;
flex: none;
color: #000;
opacity: 0.6;
}
.emotion-9 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
display: block;
}
.emotion-10 {
margin: 0;
color: #4b5e40;
-webkit-text-decoration: none;
text-decoration: none;
}
.emotion-10:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-11 {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
white-space: nowrap;
height: 0.5em;
margin: 0 16px;
}
<body>
"baseElement": <body>
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiBox-root emotion-2"
class="MuiBox-root"
data-testid="uplinks"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-3 emotion-4"
class="MuiTypography-root MuiTypography-subtitle1 ebttozw2 makeStyles-MuiTypography-root-StyledText"
>
uplinks.title
</h6>
<ul
class="MuiList-root MuiList-padding MuiList-dense emotion-5"
class="MuiList-root MuiList-padding MuiList-dense makeStyles-MuiList-root"
>
<li
class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding version-item emotion-6"
class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding version-item makeStyles-MuiListItem-root"
data-testid="uplink-npmjs"
>
<div
class="MuiListItemText-root MuiListItemText-dense emotion-7 emotion-8"
class="MuiListItemText-root MuiListItemText-dense ebttozw0 makeStyles-MuiListItemText-root-ListItemText"
>
<span
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary emotion-9"
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary makeStyles-MuiTypography-root"
>
<a
class="MuiTypography-root MuiTypography-outline MuiLink-root MuiLink-underlineHover emotion-10"
class="MuiTypography-root MuiTypography-outline MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
href="https://www.npmjs.com/package/verdaccio"
rel="noopener noreferrer"
target="_blank"
@ -488,14 +183,14 @@ exports[`<UpLinks /> component should render the component with uplinks 1`] = `
</span>
</div>
<div
class="emotion-11 emotion-12"
class="makeStyles-Spacer ebttozw1"
/>
<div
class="MuiListItemText-root MuiListItemText-dense emotion-7 emotion-8"
class="MuiListItemText-root MuiListItemText-dense ebttozw0 makeStyles-MuiListItemText-root-ListItemText"
title="06/23/2018 6:52:14 PM"
>
<span
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary emotion-9"
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary makeStyles-MuiTypography-root"
>
6 years ago
</span>
@ -507,166 +202,37 @@ exports[`<UpLinks /> component should render the component with uplinks 1`] = `
</div>
</div>
</body>,
"container": .emotion-0 {
background-color: #fff;
color: rgba(0, 0, 0, 0.87);
-webkit-transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 4px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
background-image: unset;
overflow: hidden;
margin-bottom: 16px;
}
.emotion-1 {
padding: 16px;
}
.emotion-1:last-child {
padding-bottom: 24px;
}
.emotion-2 {
margin: 16px;
}
.emotion-4 {
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-5 {
list-style: none;
margin: 0;
padding: 0;
position: relative;
padding-top: 8px;
padding-bottom: 8px;
}
.emotion-6 {
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: 4px;
padding-bottom: 4px;
padding-left: 16px;
padding-right: 16px;
padding-right: 0px;
}
.emotion-6.Mui-focusVisible {
background-color: rgba(0, 0, 0, 0.12);
}
.emotion-6.Mui-selected {
background-color: rgba(75, 94, 64, 0.08);
}
.emotion-6.Mui-selected.Mui-focusVisible {
background-color: rgba(75, 94, 64, 0.2);
}
.emotion-6.Mui-disabled {
opacity: 0.38;
}
.emotion-8 {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-width: 0;
margin-top: 4px;
margin-bottom: 4px;
-webkit-flex: none;
-ms-flex: none;
flex: none;
color: #000;
opacity: 0.6;
}
.emotion-9 {
margin: 0;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
display: block;
}
.emotion-10 {
margin: 0;
color: #4b5e40;
-webkit-text-decoration: none;
text-decoration: none;
}
.emotion-10:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.emotion-11 {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
white-space: nowrap;
height: 0.5em;
margin: 0 16px;
}
<div>
"container": <div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root makeStyles-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root emotion-1"
class="MuiCardContent-root makeStyles-MuiCardContent-root"
>
<div
class="MuiBox-root emotion-2"
class="MuiBox-root"
data-testid="uplinks"
>
<h6
class="MuiTypography-root MuiTypography-subtitle1 emotion-3 emotion-4"
class="MuiTypography-root MuiTypography-subtitle1 ebttozw2 makeStyles-MuiTypography-root-StyledText"
>
uplinks.title
</h6>
<ul
class="MuiList-root MuiList-padding MuiList-dense emotion-5"
class="MuiList-root MuiList-padding MuiList-dense makeStyles-MuiList-root"
>
<li
class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding version-item emotion-6"
class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding version-item makeStyles-MuiListItem-root"
data-testid="uplink-npmjs"
>
<div
class="MuiListItemText-root MuiListItemText-dense emotion-7 emotion-8"
class="MuiListItemText-root MuiListItemText-dense ebttozw0 makeStyles-MuiListItemText-root-ListItemText"
>
<span
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary emotion-9"
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary makeStyles-MuiTypography-root"
>
<a
class="MuiTypography-root MuiTypography-outline MuiLink-root MuiLink-underlineHover emotion-10"
class="MuiTypography-root MuiTypography-outline MuiLink-root MuiLink-underlineHover makeStyles-MuiTypography-root-MuiLink-root"
href="https://www.npmjs.com/package/verdaccio"
rel="noopener noreferrer"
target="_blank"
@ -676,14 +242,14 @@ exports[`<UpLinks /> component should render the component with uplinks 1`] = `
</span>
</div>
<div
class="emotion-11 emotion-12"
class="makeStyles-Spacer ebttozw1"
/>
<div
class="MuiListItemText-root MuiListItemText-dense emotion-7 emotion-8"
class="MuiListItemText-root MuiListItemText-dense ebttozw0 makeStyles-MuiListItemText-root-ListItemText"
title="06/23/2018 6:52:14 PM"
>
<span
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary emotion-9"
class="MuiTypography-root MuiTypography-body2 MuiListItemText-primary makeStyles-MuiTypography-root"
>
6 years ago
</span>

@ -1,6 +1,7 @@
/* eslint-disable verdaccio/jsx-spread */
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { vi } from 'vitest';
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
import Versions, { Props } from './Versions';
@ -13,16 +14,15 @@ const VersionsComponent: React.FC<Props> = (props) => (
</MemoryRouter>
);
jest.mock('lodash/debounce', () =>
jest.fn((fn) => {
fn.cancel = jest.fn();
return fn;
})
);
vi.mock('lodash/debounce', () => ({
default: vi.fn((fn) => {
// Immediately execute the function for testing
return (...args: any[]) => fn(...args);
}),
}));
describe('<Version /> component', () => {
afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});
test('should render versions', () => {

@ -3,6 +3,7 @@ import i18n from 'i18next';
import React from 'react';
import { initReactI18next } from 'react-i18next';
import { useTranslation } from 'react-i18next';
import { vi } from 'vitest';
import TranslatorProvider, { useLanguage } from './TranslatorProvider';
@ -41,7 +42,7 @@ const RandomComponent = () => {
};
test('should provide translation', () => {
const mount = jest.fn();
const mount = vi.fn();
const { getByText } = render(
<TranslatorProvider i18n={i18n} listLanguages={[]} onMount={mount}>
<RandomComponent />

@ -39,7 +39,7 @@ interface Params {
}
/**
*
*
* @example
Once a component has been wrapped with `VersionProvider`, use the hook `useVersion()` to get an object with:
```jsx
@ -58,7 +58,10 @@ interface Params {
@category Provider
*/
const VersionProvider: React.FC<{ children: any }> = ({ children }) => {
const { version: packageVersion, package: pkgName, scope } = useParams<Params>();
const router = useParams<Params>();
const { version: packageVersion, package: pkgName, scope } = router;
// @ts-ignore
const { manifest, readme, packageName, hasNotBeenFound } = useSelector(
(state: RootState) => state.manifest

@ -1,177 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DetailContainer renders correctly 1`] = `
.emotion-0 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding: 0px;
}
.emotion-2 {
overflow: hidden;
min-height: 48px;
-webkit-overflow-scrolling: touch;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
margin-bottom: 16px;
}
@media (max-width:599.95px) {
.emotion-2 .MuiTabs-scrollButtons {
display: none;
}
}
.emotion-3 {
position: relative;
display: inline-block;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
white-space: nowrap;
overflow-x: hidden;
width: 100%;
}
.emotion-4 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.emotion-5 {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-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;
position: relative;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
background-color: transparent;
outline: 0;
border: 0;
margin: 0;
border-radius: 0;
padding: 0;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
vertical-align: middle;
-moz-appearance: none;
-webkit-appearance: none;
-webkit-text-decoration: none;
text-decoration: none;
color: inherit;
font-family: -apple-system,BlinkMacSystemFont,"Helvetica Neue",Arial,sans-serif;
font-weight: 500;
font-size: 0.875rem;
line-height: 1.25;
text-transform: uppercase;
max-width: none;
min-width: 90px;
position: relative;
min-height: 48px;
-webkit-flex-shrink: 1;
-ms-flex-negative: 1;
flex-shrink: 1;
padding: 12px 16px;
overflow: hidden;
white-space: normal;
text-align: center;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
color: rgba(0, 0, 0, 0.6);
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-webkit-flex-basis: 0;
-ms-flex-preferred-size: 0;
flex-basis: 0;
}
.emotion-5::-moz-focus-inner {
border-style: none;
}
.emotion-5.Mui-disabled {
pointer-events: none;
cursor: default;
}
@media print {
.emotion-5 {
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
}
.emotion-5.Mui-selected {
color: #4b5e40;
}
.emotion-5.Mui-disabled {
color: rgba(0, 0, 0, 0.38);
}
.emotion-6 {
overflow: hidden;
pointer-events: none;
position: absolute;
z-index: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: inherit;
}
.emotion-13 {
position: absolute;
height: 2px;
bottom: 0;
width: 100%;
-webkit-transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
background-color: #4b5e40;
}
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`DetailContainer > renders correctly 1`] = `
<div
class="MuiBox-root emotion-0"
class="MuiBox-root"
>
<div
class="MuiTabs-root emotion-1 emotion-2"
class="MuiTabs-root e1g9ee4l0 makeStyles-MuiTabs-root-Tabs"
>
<div
class="MuiTabs-scroller MuiTabs-fixed emotion-3"
class="MuiTabs-scroller MuiTabs-fixed makeStyles-MuiTabs-scroller"
style="overflow: hidden; margin-bottom: 0px;"
>
<div
class="MuiTabs-flexContainer emotion-4"
class="MuiTabs-flexContainer makeStyles-MuiTabs-flexContainer"
role="tablist"
>
<button
aria-selected="true"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth Mui-selected emotion-5"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth Mui-selected makeStyles-MuiButtonBase-root-MuiTab-root"
data-testid="readme-tab"
id="readme-tab"
role="tab"
@ -180,12 +26,12 @@ exports[`DetailContainer renders correctly 1`] = `
>
tab.readme
<span
class="MuiTouchRipple-root emotion-6"
class="MuiTouchRipple-root makeStyles-MuiTouchRipple-root"
/>
</button>
<button
aria-selected="false"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth emotion-5"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth makeStyles-MuiButtonBase-root-MuiTab-root"
data-testid="dependencies-tab"
id="dependencies-tab"
role="tab"
@ -194,12 +40,12 @@ exports[`DetailContainer renders correctly 1`] = `
>
tab.dependencies
<span
class="MuiTouchRipple-root emotion-6"
class="MuiTouchRipple-root makeStyles-MuiTouchRipple-root"
/>
</button>
<button
aria-selected="false"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth emotion-5"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth makeStyles-MuiButtonBase-root-MuiTab-root"
data-testid="versions-tab"
id="versions-tab"
role="tab"
@ -208,12 +54,12 @@ exports[`DetailContainer renders correctly 1`] = `
>
tab.versions
<span
class="MuiTouchRipple-root emotion-6"
class="MuiTouchRipple-root makeStyles-MuiTouchRipple-root"
/>
</button>
<button
aria-selected="false"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth emotion-5"
class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary MuiTab-fullWidth makeStyles-MuiButtonBase-root-MuiTab-root"
data-testid="uplinks-tab"
id="uplinks-tab"
role="tab"
@ -222,12 +68,12 @@ exports[`DetailContainer renders correctly 1`] = `
>
tab.uplinks
<span
class="MuiTouchRipple-root emotion-6"
class="MuiTouchRipple-root makeStyles-MuiTouchRipple-root"
/>
</button>
</div>
<span
class="MuiTabs-indicator emotion-13"
class="MuiTabs-indicator makeStyles-MuiTabs-indicator"
style="left: 0px; width: 0px;"
/>
</div>

@ -1,5 +1,9 @@
/**
* @vitest-environment jsdom
*/
import React from 'react';
import { MemoryRouter } from 'react-router';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { store } from '../../store';
import { act, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
@ -7,8 +11,8 @@ import Home from './Home';
// 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);
const ComponentHome: React.FC = () => (
<MemoryRouter>
@ -18,7 +22,7 @@ const ComponentHome: React.FC = () => (
describe('Home', () => {
afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});
test('should render titles', async () => {

@ -1,26 +1,27 @@
import React from 'react';
import { MemoryRouter } from 'react-router';
import { vi } from 'vitest';
import { VersionProvider } from '../../providers';
import { store } from '../../store';
import { act, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
import Sidebar from './Sidebar';
jest.mock('marked');
jest.mock('marked-highlight');
vi.mock('marked');
vi.mock('marked-highlight');
const ComponentSideBar: React.FC = () => (
<MemoryRouter>
<MemoryRouter initialEntries={[`/-/web/detail/jquery`]}>
<VersionProvider>
<Sidebar />
</VersionProvider>
</MemoryRouter>
);
const mockPkgName = jest.fn().mockReturnValue('jquery');
const mockPkgName = vi.fn().mockReturnValue('jquery');
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'), // use actual for all non-hook parts
vi.mock('react-router-dom', async (importOriginal) => ({
...(await importOriginal<typeof import('react-router-dom')>()),
useParams: () => ({
package: mockPkgName(),
}),
@ -28,7 +29,7 @@ jest.mock('react-router-dom', () => ({
describe('Sidebar', () => {
afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});
test('should render titles', async () => {
act(() => {

@ -26,6 +26,7 @@ const getModuleType = (manifest: PackageMetaInterface) => {
const DetailSidebar: React.FC = () => {
const { packageMeta, packageName, packageVersion } = useVersion();
const { configOptions } = useConfig();
const version = packageVersion || packageMeta?.latest.version || '';
const time = packageMeta?.time ? packageMeta.time[version] : '';

@ -1,3 +1,5 @@
import { vi } from 'vitest';
import api, { handleResponseType } from './api';
describe('api', () => {
@ -50,10 +52,10 @@ describe('api', () => {
});
describe('api client', () => {
let fetchSpy: jest.SpyInstance;
let fetchSpy;
beforeEach(() => {
fetchSpy = jest.spyOn(window, 'fetch');
fetchSpy = vi.spyOn(window, 'fetch');
});
afterEach(() => {
@ -81,9 +83,9 @@ describe('api', () => {
expect(response).toEqual({ a: 1 });
});
test('when there is token from storage', async () => {
jest.resetModules();
jest.doMock('./storage', () => ({ getItem: () => 'token-xx-xx-xx' }));
test.skip('when there is token from storage', async () => {
vi.resetModules();
vi.doMock('./storage', () => ({ getItem: () => 'token-xx-xx-xx' }));
fetchSpy.mockImplementation(() =>
Promise.resolve({
@ -95,7 +97,7 @@ describe('api', () => {
})
);
const api = require('./api').default;
const api = await require('./api').default;
const response = await api.request('https://verdaccio.tld/resource', 'GET');
expect(fetchSpy).toHaveBeenCalledWith('https://verdaccio.tld/resource', {

@ -1,20 +1,22 @@
// eslint-disable-next-line jest/no-mocks-import
import { generateTokenWithTimeRange } from '../../../jest/unit/components/__mocks__/token';
import { vi } from 'vitest';
// import { generateTokenWithTimeRange } from '../../../jest/unit/components/__mocks__/token';
describe('getDefaultUserState', (): void => {
const username = 'xyz';
beforeEach(() => {
jest.resetModules();
vi.resetModules();
});
test('should return state with empty user', (): void => {
test('should return state with empty user', async () => {
const token = 'token-xx-xx-xx';
jest.doMock('../storage', () => ({
vi.doMock('../storage', async (importOriginal) => ({
...(await importOriginal<typeof import('../storage')>()),
getItem: (key: string) => (key === 'token' ? token : username),
}));
const { getDefaultUserState } = require('./login');
const Login = await import('./login');
const { getDefaultUserState } = Login;
const result = {
token: null,
username: null,
@ -22,17 +24,19 @@ describe('getDefaultUserState', (): void => {
expect(getDefaultUserState()).toEqual(result);
});
test('should return state with user from storage', (): void => {
const token = generateTokenWithTimeRange(24);
jest.doMock('../storage', () => ({
getItem: (key: string) => (key === 'token' ? token : username),
}));
const { getDefaultUserState } = require('./login');
const result = {
token,
username,
};
expect(getDefaultUserState()).toEqual(result);
});
// test('should return state with user from storage', async () => {
// const token = generateTokenWithTimeRange(24);
//
// vi.doMock('../storage', async (importOriginal) => ({
// ...(await importOriginal<typeof import('../storage')>()),
// getItem: (key: string) => (key === 'token' ? token : username),
// }));
// const Login = await import('./login');
// const { getDefaultUserState } = Login;
// const result = {
// token,
// username,
// };
// expect(getDefaultUserState()).toEqual(result);
// });
});

@ -31,11 +31,9 @@ const customRender = (node: React.ReactElement, ...options: any) => {
return render(
<AppConfigurationProvider>
<PersistenceSettingProvider>
<StyledEngineProvider injectFirst={true}>
<ThemeProvider>
<I18nextProvider i18n={i18nConfig}>{node}</I18nextProvider>
</ThemeProvider>
</StyledEngineProvider>
<ThemeProvider>
<I18nextProvider i18n={i18nConfig}>{node}</I18nextProvider>
</ThemeProvider>
</PersistenceSettingProvider>
</AppConfigurationProvider>,
...options

@ -1,4 +1,5 @@
import { SyntheticEvent } from 'react';
import { vi } from 'vitest';
import { copyToClipBoardUtility, getCLISetConfigRegistry } from './cli-utils';
@ -6,30 +7,30 @@ describe('copyToClipBoardUtility', () => {
let originalGetSelection: typeof window.getSelection;
const mockGetSelectionResult = {
removeAllRanges: jest.fn(),
addRange: jest.fn(),
removeAllRanges: vi.fn(),
addRange: vi.fn(),
};
beforeEach(() => {
originalGetSelection = window.getSelection;
window.getSelection = jest.fn().mockReturnValue(mockGetSelectionResult);
window.getSelection = vi.fn().mockReturnValue(mockGetSelectionResult);
});
afterEach(() => {
window.getSelection = originalGetSelection;
jest.restoreAllMocks();
vi.restoreAllMocks();
});
test('should call the DOM APIs', () => {
// Given
const testEvent: { preventDefault: Function } = {
preventDefault: jest.fn(),
preventDefault: vi.fn(),
};
const testCopy = 'copy text';
const spys = {
createElement: jest.spyOn(document, 'createElement'),
execCommand: jest.spyOn(document, 'execCommand'),
appendChild: jest.spyOn(document.body, 'appendChild'),
removeChild: jest.spyOn(document.body, 'removeChild'),
createElement: vi.spyOn(document, 'createElement'),
execCommand: vi.spyOn(document, 'execCommand'),
appendChild: vi.spyOn(document.body, 'appendChild'),
removeChild: vi.spyOn(document.body, 'removeChild'),
};
const expectedDiv = document.createElement('div');
expectedDiv.innerText = testCopy;

@ -1,14 +1,16 @@
// eslint-disable-next-line jest/no-mocks-import
import { vi } from 'vitest';
/* eslint-disable jest/no-mocks-import */
import {
generateInvalidToken,
generateTokenWithExpirationAsString,
generateTokenWithOutExpiration,
generateTokenWithTimeRange,
} from '../../jest/unit/components/__mocks__/token';
} from '../../vitest/unit/components/__mocks__/token';
import { isTokenExpire } from './token';
/* eslint-disable no-console */
console.error = jest.fn();
console.error = vi.fn();
describe('isTokenExpire', (): void => {
test('isTokenExpire - null is not a valid payload', (): void => {

@ -13,7 +13,7 @@
"jsx": "react"
},
"include": ["src/**/*", "./src/types/index.d.ts"],
"types": ["node", "jest", "@testing-library/jest-dom"],
"types": ["node", "@testing-library/jest-dom"],
"typedocOptions": {
"categoryOrder": ["Model", "Component", "Provider", "*"],
"defaultCategory": "Component",

@ -0,0 +1,39 @@
import react from '@vitejs/plugin-react';
import path from 'node:path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest/setup.ts', './vitest/setup-env.ts'],
exclude: ['node_modules', './build/'],
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
snapshotSerializers: ['./vitest/vitestSerializer.ts'],
alias: {
// https://github.com/vitest-dev/vitest/issues/5664#issuecomment-2093986338
'@emotion/react': path.resolve('node_modules/@emotion/react/dist/emotion-react.cjs.mjs'),
'\\.(s?css)$': './vitest/identity.js',
'\\.(png)$': './vitest/identity.js',
'\\.(svg)$': './vitest/unit/empty.ts',
'\\.(jpg)$': './vitest/unit/empty.ts',
'\\.(md)$': './vitest/unit/empty-string.ts',
},
},
plugins: [
react({
babel: {
plugins: ['@emotion'],
},
}),
],
resolve: {
alias: {
'verdaccio-ui/components': path.resolve(__dirname, './src/components'),
'verdaccio-ui/utils': path.resolve(__dirname, './src/utils'),
},
},
});

@ -0,0 +1,46 @@
import '@testing-library/jest-dom';
import 'mutationobserver-shim';
import { afterAll, afterEach, beforeAll, vi } from 'vitest';
import 'whatwg-fetch';
import { server } from './jest/server';
//
// Mock react-markdown globally
vi.mock('react-markdown', () => import('../__mocks__/react-markdown'));
// @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
global.__VERDACCIO_BASENAME_UI_OPTIONS = {
base: 'http://localhost:9000/',
protocol: 'http',
host: 'localhost',
primaryColor: '#4b5e40',
url_prefix: '',
darkMode: false,
language: 'en-US',
uri: 'http://localhost:9000/',
pkgManagers: ['pnpm', 'yarn', 'npm'],
title: 'Verdaccio Dev UI',
scope: '',
version: 'v1.0.0',
};
// mocking few DOM methods
// @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 = vi.fn((): void => ({
selectNodeContents: (): void => {},
}));
document.execCommand = vi.fn();
}
beforeAll(() => {
server.listen({
onUnhandledRequest: 'warn',
});
});
afterEach(() => server.resetHandlers());
afterAll(() => {
server.close();
});

@ -0,0 +1,7 @@
import React from 'react';
import { vi } from 'vitest';
// Mock react-markdown globally
vi.mock('react-markdown', () => ({
default: ({ children }: { children: React.ReactNode }) => <>{children}</>,
}));

@ -0,0 +1,33 @@
import '@testing-library/jest-dom';
import 'whatwg-fetch';
import { server } from './server';
// Configure the test environment URL
Object.defineProperty(window, 'location', {
writable: true,
value: new URL('http://localhost:9000/'),
});
beforeAll(() => {
// Enable debug logging
// server.events.on('request:start', (req) => {
// console.log('Request started:', req.url.href);
// });
// server.events.on('request:match', (req) => {
// console.log('Request matched:', req.url.href);
// });
// server.events.on('request:unhandled', (req) => {
// console.warn('Unhandled request:', req.url.href);
// });
// server.events.on('request:end', (req) => {
// console.log('Request completed:', req.url.href);
// });
server.listen({
onUnhandledRequest: 'warn',
});
});
afterEach(() => server.resetHandlers());
afterAll(() => {
server.close();
});

@ -0,0 +1,40 @@
/**
* 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 = {
base: 'http://localhost:9000/',
protocol: 'http',
host: 'localhost',
primaryColor: '#4b5e40',
url_prefix: '',
darkMode: false,
language: 'en-US',
uri: 'http://localhost:9000/',
pkgManagers: ['pnpm', 'yarn', 'npm'],
title: 'Verdaccio Dev UI',
scope: '',
version: 'v1.0.0',
};
// mocking few DOM methods
// @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 = vi.fn((): void => ({
selectNodeContents: (): void => {},
}));
document.execCommand = vi.fn();
}

@ -0,0 +1,31 @@
import { SnapshotSerializer } from 'vitest';
const serializer: SnapshotSerializer = {
serialize(val, config, indentation, depth, refs, printer) {
for (const className of [...val.classList]) {
if (className.startsWith('css-')) {
const hashEnd = className.indexOf('-', 4);
if (hashEnd >= 0) {
val.classList.replace(className, 'makeStyles' + className.substring(hashEnd));
} else {
val.classList.remove(className);
}
}
}
if (!val.classList.length) {
val.removeAttribute('class');
}
return printer(val, config, indentation, depth, refs);
},
test(val) {
return val instanceof Element && [...val.classList].some((name) => name.startsWith('css-'));
},
};
/**
* An object snapshot serializer that removes dynamic CSS classes (generated by makeStyle) from DOM elements.
*
* `css-hash-suffix` is transformed into `makeStyles-suffix`
* `css-hash` is removed
*/
export default serializer;

906
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff