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:
parent
79c1fedc1b
commit
0c7b19b192
39 changed files with 52 additions and 58 deletions
|
@ -1,9 +0,0 @@
|
|||
const config = require('../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
lines: 90,
|
||||
},
|
||||
},
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
const config = require('../../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {});
|
|
@ -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",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { HTTP_STATUS } from '../src/constants';
|
||||
import {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { mergeVersions, semverSort } from '../src/pkg-utils';
|
||||
|
||||
describe('Storage._merge_versions versions', () => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Stream } from 'stream';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { readableToString } from '../src/stream-utils';
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { DIST_TAGS, pkgUtils } from '../src';
|
||||
|
||||
describe('pkg-utils', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { stringUtils } from '../src';
|
||||
|
||||
describe('string-utils', () => {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
const config = require('../../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {});
|
|
@ -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",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as httpMocks from 'node-mocks-http';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { HEADERS } from '@verdaccio/core';
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { extractTarballFromUrl } from '../src';
|
||||
|
||||
describe('extractTarballFromUrl', () => {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { getTarballDetails } from '../src/getTarballDetails.ts';
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
const config = require('../../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {});
|
|
@ -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",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { combineBaseUrl } from '../src';
|
||||
|
||||
describe('combineBaseUrl', () => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as httpMocks from 'node-mocks-http';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { HEADERS } from '@verdaccio/core';
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { getWebProtocol } from '../src';
|
||||
|
||||
describe('getWebProtocol', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { expect, test } from 'vitest';
|
||||
|
||||
import { isURLhasValidProtocol } from '../src';
|
||||
|
||||
test('should be HTTP/HTTPS protocol', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { expect, test } from 'vitest';
|
||||
|
||||
import { isHost } from '../src';
|
||||
|
||||
test('valid host', () => {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
const config = require('../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
testEnvironment: 'node',
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
const config = require('../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
// FIXME: increase to 90
|
||||
lines: 68,
|
||||
},
|
||||
},
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
const config = require('../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {});
|
|
@ -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",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { createRemoteUser } from '@verdaccio/config';
|
||||
|
||||
import { signPayload, verifyPayload } from '../src';
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { isNodeVersionGreaterThan21 } from '@verdaccio/config';
|
||||
|
||||
import {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { aesDecrypt, aesEncrypt } from '../src';
|
||||
|
||||
describe('test crypto utils', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
TOKEN_VALID_LENGTH,
|
||||
createTarballHash,
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
const config = require('../../jest/config');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
// FIXME: increase to 90
|
||||
lines: 60,
|
||||
},
|
||||
},
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { createSessionToken, getAuthenticatedMessage } from '../src';
|
||||
|
||||
describe('Auth Utilities', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { getMatchedPackagesSpec } from '../src/matcher';
|
||||
|
||||
describe('getMatchedPackagesSpec', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { getVersionFromTarball } from '../src/middleware-utils';
|
||||
|
||||
describe('Utilities', () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { DEFAULT_USER } from '@verdaccio/core';
|
||||
|
||||
import {
|
||||
|
|
Loading…
Reference in a new issue