0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

chore: migrate vitest packages (#4777)

* chore: migrate core to vitest

* chore: migrate url module

* chore: migrate tarball package

* chore: migrate loader package

* chore: migrate hook package

* chore: migrate signature package

* chore: migrate utils package
This commit is contained in:
Juan Picado 2024-08-03 19:39:22 +02:00 committed by GitHub
parent 79c1fedc1b
commit 0c7b19b192
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 52 additions and 58 deletions

View file

@ -1,9 +0,0 @@
const config = require('../../jest/config');
module.exports = Object.assign({}, config, {
coverageThreshold: {
global: {
lines: 90,
},
},
});

View file

@ -1,3 +0,0 @@
const config = require('../../../jest/config');
module.exports = Object.assign({}, config, {});

View file

@ -19,7 +19,7 @@
"license": "MIT",
"homepage": "https://verdaccio.org",
"engines": {
"node": ">=12"
"node": ">=14"
},
"repository": {
"type": "https",
@ -48,7 +48,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:docs": "typedoc --options ./typedoc.json --tsconfig tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",

View file

@ -1,4 +1,5 @@
import _ from 'lodash';
import { describe, expect, test } from 'vitest';
import { HTTP_STATUS } from '../src/constants';
import {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { mergeVersions, semverSort } from '../src/pkg-utils';
describe('Storage._merge_versions versions', () => {

View file

@ -1,4 +1,5 @@
import { Stream } from 'stream';
import { describe, expect, test } from 'vitest';
import { readableToString } from '../src/stream-utils';

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { DIST_TAGS, pkgUtils } from '../src';
describe('pkg-utils', () => {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { stringUtils } from '../src';
describe('string-utils', () => {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS } from '../src/constants';
import { validatePublishSingleVersion } from '../src/schemes/publish-manifest';
import {
@ -62,10 +64,9 @@ describe('normalizeMetadata', () => {
test('should fails the assertions is name does not match', () => {
expect(function () {
// @ts-ignore
// @ts-expect-error
normalizeMetadata({}, 'no-name');
// @ts-ignore
}).toThrow(expect.hasAssertions());
}).toThrowError();
});
});

View file

@ -1,3 +0,0 @@
const config = require('../../../jest/config');
module.exports = Object.assign({}, config, {});

View file

@ -19,7 +19,7 @@
"license": "MIT",
"homepage": "https://verdaccio.org",
"engines": {
"node": ">=12"
"node": ">=14"
},
"repository": {
"type": "https",
@ -47,7 +47,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,4 +1,5 @@
import * as httpMocks from 'node-mocks-http';
import { describe, expect, test } from 'vitest';
import { HEADERS } from '@verdaccio/core';

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { extractTarballFromUrl } from '../src';
describe('extractTarballFromUrl', () => {

View file

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import { describe, expect, test } from 'vitest';
import { getTarballDetails } from '../src/getTarballDetails.ts';

View file

@ -1,3 +0,0 @@
const config = require('../../../jest/config');
module.exports = Object.assign({}, config, {});

View file

@ -44,7 +44,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { combineBaseUrl } from '../src';
describe('combineBaseUrl', () => {

View file

@ -1,4 +1,5 @@
import * as httpMocks from 'node-mocks-http';
import { describe, expect, test } from 'vitest';
import { HEADERS } from '@verdaccio/core';

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { getWebProtocol } from '../src';
describe('getWebProtocol', () => {

View file

@ -1,3 +1,5 @@
import { expect, test } from 'vitest';
import { isURLhasValidProtocol } from '../src';
test('should be HTTP/HTTPS protocol', () => {

View file

@ -1,3 +1,5 @@
import { expect, test } from 'vitest';
import { isHost } from '../src';
test('valid host', () => {

View file

@ -1,5 +0,0 @@
const config = require('../../jest/config');
module.exports = Object.assign({}, config, {
testEnvironment: 'node',
});

View file

@ -44,7 +44,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,4 +1,5 @@
import nock from 'nock';
import { beforeEach, describe, expect, test } from 'vitest';
import { createRemoteUser, parseConfigFile } from '@verdaccio/config';
import { setup } from '@verdaccio/logger';

View file

@ -1,10 +0,0 @@
const config = require('../../jest/config');
module.exports = Object.assign({}, config, {
coverageThreshold: {
global: {
// FIXME: increase to 90
lines: 68,
},
},
});

View file

@ -43,7 +43,7 @@
"license": "MIT",
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,4 +1,5 @@
import path from 'path';
import { describe, expect, test } from 'vitest';
import { Config, parseConfigFile } from '@verdaccio/config';
import { pluginUtils } from '@verdaccio/core';

View file

@ -1,3 +0,0 @@
const config = require('../../jest/config');
module.exports = Object.assign({}, config, {});

View file

@ -30,7 +30,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "jest",
"test": "vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { createRemoteUser } from '@verdaccio/config';
import { signPayload, verifyPayload } from '../src';

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { isNodeVersionGreaterThan21 } from '@verdaccio/config';
import {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { aesDecrypt, aesEncrypt } from '../src';
describe('test crypto utils', () => {

View file

@ -1,3 +1,5 @@
import { expect, test } from 'vitest';
import {
TOKEN_VALID_LENGTH,
createTarballHash,

View file

@ -1,10 +0,0 @@
const config = require('../../jest/config');
module.exports = Object.assign({}, config, {
coverageThreshold: {
global: {
// FIXME: increase to 90
lines: 60,
},
},
});

View file

@ -36,7 +36,7 @@
},
"scripts": {
"clean": "rimraf ./build",
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest",
"test": "cross-env NODE_ENV=test BABEL_ENV=test vitest run",
"type-check": "tsc --noEmit -p tsconfig.build.json",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { createSessionToken, getAuthenticatedMessage } from '../src';
describe('Auth Utilities', () => {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { getMatchedPackagesSpec } from '../src/matcher';
describe('getMatchedPackagesSpec', () => {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { getVersionFromTarball } from '../src/middleware-utils';
describe('Utilities', () => {

View file

@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest';
import { DEFAULT_USER } from '@verdaccio/core';
import {