diff --git a/packages/config/jest.config.js b/packages/config/jest.config.js deleted file mode 100644 index 16cb0e906..000000000 --- a/packages/config/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - coverageThreshold: { - global: { - lines: 90, - }, - }, -}); diff --git a/packages/core/core/jest.config.js b/packages/core/core/jest.config.js deleted file mode 100644 index 1c3fbdb05..000000000 --- a/packages/core/core/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const config = require('../../../jest/config'); - -module.exports = Object.assign({}, config, {}); diff --git a/packages/core/core/package.json b/packages/core/core/package.json index 5e9b48163..49b0a1927 100644 --- a/packages/core/core/package.json +++ b/packages/core/core/package.json @@ -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", diff --git a/packages/core/core/test/errors.spec.ts b/packages/core/core/test/errors.spec.ts index 8dfcc9419..10729e9ca 100644 --- a/packages/core/core/test/errors.spec.ts +++ b/packages/core/core/test/errors.spec.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; +import { describe, expect, test } from 'vitest'; import { HTTP_STATUS } from '../src/constants'; import { diff --git a/packages/core/core/test/merge.dist.tags.spec.ts b/packages/core/core/test/merge.dist.tags.spec.ts index eb0018528..ca44ca8ca 100644 --- a/packages/core/core/test/merge.dist.tags.spec.ts +++ b/packages/core/core/test/merge.dist.tags.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { mergeVersions, semverSort } from '../src/pkg-utils'; describe('Storage._merge_versions versions', () => { diff --git a/packages/core/core/test/mystreams.spec.ts b/packages/core/core/test/mystreams.spec.ts index 496fa4bb3..b894c5e10 100644 --- a/packages/core/core/test/mystreams.spec.ts +++ b/packages/core/core/test/mystreams.spec.ts @@ -1,4 +1,5 @@ import { Stream } from 'stream'; +import { describe, expect, test } from 'vitest'; import { readableToString } from '../src/stream-utils'; diff --git a/packages/core/core/test/pkg-utils.spec.ts b/packages/core/core/test/pkg-utils.spec.ts index fba402697..34420650e 100644 --- a/packages/core/core/test/pkg-utils.spec.ts +++ b/packages/core/core/test/pkg-utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { DIST_TAGS, pkgUtils } from '../src'; describe('pkg-utils', () => { diff --git a/packages/core/core/test/string-utils.spec.ts b/packages/core/core/test/string-utils.spec.ts index 476bea5ae..5a46c0ab4 100644 --- a/packages/core/core/test/string-utils.spec.ts +++ b/packages/core/core/test/string-utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { stringUtils } from '../src'; describe('string-utils', () => { diff --git a/packages/core/core/test/validation-utilts.spec.ts b/packages/core/core/test/validation-utilts.spec.ts index bc3a91fea..81d323a26 100644 --- a/packages/core/core/test/validation-utilts.spec.ts +++ b/packages/core/core/test/validation-utilts.spec.ts @@ -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(); }); }); diff --git a/packages/core/tarball/jest.config.js b/packages/core/tarball/jest.config.js deleted file mode 100644 index 1c3fbdb05..000000000 --- a/packages/core/tarball/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const config = require('../../../jest/config'); - -module.exports = Object.assign({}, config, {}); diff --git a/packages/core/tarball/package.json b/packages/core/tarball/package.json index 86c6eb6d8..4343eebab 100644 --- a/packages/core/tarball/package.json +++ b/packages/core/tarball/package.json @@ -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", diff --git a/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts b/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts index 48fef9fb4..3fdfd5fd0 100644 --- a/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts +++ b/packages/core/tarball/tests/convertDistRemoteToLocalTarballUrls.spec.ts @@ -1,4 +1,5 @@ import * as httpMocks from 'node-mocks-http'; +import { describe, expect, test } from 'vitest'; import { HEADERS } from '@verdaccio/core'; diff --git a/packages/core/tarball/tests/getLocalRegistryTarballUri.spec.ts b/packages/core/tarball/tests/getLocalRegistryTarballUri.spec.ts index da49e886e..01b113c4a 100644 --- a/packages/core/tarball/tests/getLocalRegistryTarballUri.spec.ts +++ b/packages/core/tarball/tests/getLocalRegistryTarballUri.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { extractTarballFromUrl } from '../src'; describe('extractTarballFromUrl', () => { diff --git a/packages/core/tarball/tests/getTarballDetails.spec.ts b/packages/core/tarball/tests/getTarballDetails.spec.ts index 405391722..552054e00 100644 --- a/packages/core/tarball/tests/getTarballDetails.spec.ts +++ b/packages/core/tarball/tests/getTarballDetails.spec.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; +import { describe, expect, test } from 'vitest'; import { getTarballDetails } from '../src/getTarballDetails.ts'; diff --git a/packages/core/url/jest.config.js b/packages/core/url/jest.config.js deleted file mode 100644 index 1c3fbdb05..000000000 --- a/packages/core/url/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const config = require('../../../jest/config'); - -module.exports = Object.assign({}, config, {}); diff --git a/packages/core/url/package.json b/packages/core/url/package.json index 08d19069d..9642f4bee 100644 --- a/packages/core/url/package.json +++ b/packages/core/url/package.json @@ -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", diff --git a/packages/core/url/tests/combineBaseUrl.spec.ts b/packages/core/url/tests/combineBaseUrl.spec.ts index 4cd9bdea6..53bc3f4e7 100644 --- a/packages/core/url/tests/combineBaseUrl.spec.ts +++ b/packages/core/url/tests/combineBaseUrl.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { combineBaseUrl } from '../src'; describe('combineBaseUrl', () => { diff --git a/packages/core/url/tests/getPublicUrl.spec.ts b/packages/core/url/tests/getPublicUrl.spec.ts index 2313f2fde..34b93cfe5 100644 --- a/packages/core/url/tests/getPublicUrl.spec.ts +++ b/packages/core/url/tests/getPublicUrl.spec.ts @@ -1,4 +1,5 @@ import * as httpMocks from 'node-mocks-http'; +import { describe, expect, test } from 'vitest'; import { HEADERS } from '@verdaccio/core'; diff --git a/packages/core/url/tests/getWebProtocol.spec.ts b/packages/core/url/tests/getWebProtocol.spec.ts index f01169e83..46b4300fa 100644 --- a/packages/core/url/tests/getWebProtocol.spec.ts +++ b/packages/core/url/tests/getWebProtocol.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { getWebProtocol } from '../src'; describe('getWebProtocol', () => { diff --git a/packages/core/url/tests/htttProtocol.spec.ts b/packages/core/url/tests/htttProtocol.spec.ts index 74d110855..c51e855a6 100644 --- a/packages/core/url/tests/htttProtocol.spec.ts +++ b/packages/core/url/tests/htttProtocol.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest'; + import { isURLhasValidProtocol } from '../src'; test('should be HTTP/HTTPS protocol', () => { diff --git a/packages/core/url/tests/validHost.spec.ts b/packages/core/url/tests/validHost.spec.ts index f595bdd59..8d7df1050 100644 --- a/packages/core/url/tests/validHost.spec.ts +++ b/packages/core/url/tests/validHost.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest'; + import { isHost } from '../src'; test('valid host', () => { diff --git a/packages/hooks/jest.config.js b/packages/hooks/jest.config.js deleted file mode 100644 index 1fdd30d29..000000000 --- a/packages/hooks/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - testEnvironment: 'node', -}); diff --git a/packages/hooks/package.json b/packages/hooks/package.json index 67a67d4eb..25d72ba09 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -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", diff --git a/packages/hooks/test/notify-request.spec.ts b/packages/hooks/test/notify-request.spec.ts index 8231ef19b..d97535725 100644 --- a/packages/hooks/test/notify-request.spec.ts +++ b/packages/hooks/test/notify-request.spec.ts @@ -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'; diff --git a/packages/loaders/jest.config.js b/packages/loaders/jest.config.js deleted file mode 100644 index 283855bf6..000000000 --- a/packages/loaders/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - coverageThreshold: { - global: { - // FIXME: increase to 90 - lines: 68, - }, - }, -}); diff --git a/packages/loaders/package.json b/packages/loaders/package.json index d751ebbaa..8d196dc69 100644 --- a/packages/loaders/package.json +++ b/packages/loaders/package.json @@ -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", diff --git a/packages/loaders/test/plugin_loader_async.spec.ts b/packages/loaders/test/plugin_loader_async.spec.ts index eff68a4a0..aaa40f4e1 100644 --- a/packages/loaders/test/plugin_loader_async.spec.ts +++ b/packages/loaders/test/plugin_loader_async.spec.ts @@ -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'; diff --git a/packages/signature/jest.config.js b/packages/signature/jest.config.js deleted file mode 100644 index 7da7d2da8..000000000 --- a/packages/signature/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, {}); diff --git a/packages/signature/package.json b/packages/signature/package.json index 330166a6b..7e753ac17 100644 --- a/packages/signature/package.json +++ b/packages/signature/package.json @@ -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", diff --git a/packages/signature/test/jwt.spec.ts b/packages/signature/test/jwt.spec.ts index 23085de75..a4083d632 100644 --- a/packages/signature/test/jwt.spec.ts +++ b/packages/signature/test/jwt.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { createRemoteUser } from '@verdaccio/config'; import { signPayload, verifyPayload } from '../src'; diff --git a/packages/signature/test/legacy-token-deprecated.spec.ts b/packages/signature/test/legacy-token-deprecated.spec.ts index ffdea7728..f1af2ce9b 100644 --- a/packages/signature/test/legacy-token-deprecated.spec.ts +++ b/packages/signature/test/legacy-token-deprecated.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { isNodeVersionGreaterThan21 } from '@verdaccio/config'; import { diff --git a/packages/signature/test/legacy-token.spec.ts b/packages/signature/test/legacy-token.spec.ts index f2eaa0b12..3a2bc8026 100644 --- a/packages/signature/test/legacy-token.spec.ts +++ b/packages/signature/test/legacy-token.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { aesDecrypt, aesEncrypt } from '../src'; describe('test crypto utils', () => { diff --git a/packages/signature/test/utilts.spec.ts b/packages/signature/test/utilts.spec.ts index 57248c08c..b7782d303 100644 --- a/packages/signature/test/utilts.spec.ts +++ b/packages/signature/test/utilts.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest'; + import { TOKEN_VALID_LENGTH, createTarballHash, diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js deleted file mode 100644 index 44aa5663a..000000000 --- a/packages/utils/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - coverageThreshold: { - global: { - // FIXME: increase to 90 - lines: 60, - }, - }, -}); diff --git a/packages/utils/package.json b/packages/utils/package.json index dd0c4706c..68b1502e5 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -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", diff --git a/packages/utils/test/auth-utils.spec.ts b/packages/utils/test/auth-utils.spec.ts index fcd997f3f..9c921a953 100644 --- a/packages/utils/test/auth-utils.spec.ts +++ b/packages/utils/test/auth-utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { createSessionToken, getAuthenticatedMessage } from '../src'; describe('Auth Utilities', () => { diff --git a/packages/utils/test/matcher.spec.ts b/packages/utils/test/matcher.spec.ts index 2d6c0cf38..ad6b5ed9d 100644 --- a/packages/utils/test/matcher.spec.ts +++ b/packages/utils/test/matcher.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { getMatchedPackagesSpec } from '../src/matcher'; describe('getMatchedPackagesSpec', () => { diff --git a/packages/utils/test/middleware-utils.spec.ts b/packages/utils/test/middleware-utils.spec.ts index f6ff29f66..44fd03e26 100644 --- a/packages/utils/test/middleware-utils.spec.ts +++ b/packages/utils/test/middleware-utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { getVersionFromTarball } from '../src/middleware-utils'; describe('Utilities', () => { diff --git a/packages/utils/test/utils.spec.ts b/packages/utils/test/utils.spec.ts index 96ba3034e..e87958586 100644 --- a/packages/utils/test/utils.spec.ts +++ b/packages/utils/test/utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { DEFAULT_USER } from '@verdaccio/core'; import {