diff --git a/packages/loaders/src/plugin-async-loader.ts b/packages/loaders/src/plugin-async-loader.ts index 0469eb392..45cc37026 100644 --- a/packages/loaders/src/plugin-async-loader.ts +++ b/packages/loaders/src/plugin-async-loader.ts @@ -3,7 +3,6 @@ import fs from 'fs'; import { dirname, isAbsolute, join, resolve } from 'path'; import { pluginUtils } from '@verdaccio/core'; -import { logger } from '@verdaccio/logger'; import { Config, Logger } from '@verdaccio/types'; import { PluginType, isES6, isValid, tryLoad } from './utils'; @@ -54,7 +53,7 @@ export async function asyncLoadPlugin>( pluginCategory: string = '' ): Promise[]> { const pluginsIds = Object.keys(pluginConfigs); - const { config } = params; + const { config, logger } = params; let plugins: PluginType[] = []; for (let pluginId of pluginsIds) { debug('plugin %s', pluginId); diff --git a/packages/store/jest.config.js b/packages/store/jest.config.js deleted file mode 100644 index e5d1d5799..000000000 --- a/packages/store/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - coverageThreshold: { - global: { - // FIXME: increase to 90 - branches: 62, - functions: 84, - lines: 74, - }, - }, -}); diff --git a/packages/store/package.json b/packages/store/package.json index 16647b09d..692687768 100644 --- a/packages/store/package.json +++ b/packages/store/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/store/test/legacy-utils.spec.ts b/packages/store/test/legacy-utils.spec.ts index 16355f345..81df9bacb 100644 --- a/packages/store/test/legacy-utils.spec.ts +++ b/packages/store/test/legacy-utils.spec.ts @@ -1,3 +1,5 @@ +import { beforeEach, describe, expect, test } from 'vitest'; + import { checkFunctionIsPromise, promisifiedCallbackFunction } from '../src/lib/legacy-utils'; describe('utils', () => { diff --git a/packages/store/test/star-utils.test.ts b/packages/store/test/star-utils.test.ts index f0ff2d31e..e5d578248 100644 --- a/packages/store/test/star-utils.test.ts +++ b/packages/store/test/star-utils.test.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { Manifest } from '@verdaccio/types'; import { generatePackageMetadata } from '../../api/node_modules/@verdaccio/test-helper/build'; diff --git a/packages/store/test/storage-utils.spec.ts b/packages/store/test/storage-utils.spec.ts index 86b34569b..58f1d3e5e 100644 --- a/packages/store/test/storage-utils.spec.ts +++ b/packages/store/test/storage-utils.spec.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from 'vitest'; + import { DIST_TAGS } from '@verdaccio/core'; import { Manifest } from '@verdaccio/types'; diff --git a/packages/store/test/storage.database.spec.ts b/packages/store/test/storage.database.spec.ts index 4454dbbf3..af89b53c3 100644 --- a/packages/store/test/storage.database.spec.ts +++ b/packages/store/test/storage.database.spec.ts @@ -1,6 +1,7 @@ import MockDate from 'mockdate'; import nock from 'nock'; import * as httpMocks from 'node-mocks-http'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { API_ERROR, API_MESSAGE, DIST_TAGS, HEADERS, fileUtils } from '@verdaccio/core'; @@ -50,7 +51,7 @@ describe('storage', () => { beforeEach(() => { nock.cleanAll(); nock.abortPendingRequests(); - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('updateManifest', () => { diff --git a/packages/store/test/storage.plugin.spec.ts b/packages/store/test/storage.plugin.spec.ts index a9d06155c..fe64571e3 100644 --- a/packages/store/test/storage.plugin.spec.ts +++ b/packages/store/test/storage.plugin.spec.ts @@ -1,6 +1,7 @@ import MockDate from 'mockdate'; import nock from 'nock'; import path from 'path'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { DIST_TAGS } from '@verdaccio/core'; @@ -19,7 +20,7 @@ describe('storage plugin', () => { beforeEach(() => { nock.cleanAll(); nock.abortPendingRequests(); - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('Plugin Legacy Support', () => { diff --git a/packages/store/test/storage.search.spec.ts b/packages/store/test/storage.search.spec.ts index 70a618471..127505544 100644 --- a/packages/store/test/storage.search.spec.ts +++ b/packages/store/test/storage.search.spec.ts @@ -1,4 +1,5 @@ import nock from 'nock'; +import { describe, expect, test } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { fileUtils, searchUtils } from '@verdaccio/core'; diff --git a/packages/store/test/storage.spec.ts b/packages/store/test/storage.spec.ts index 4e4364303..50dc41066 100644 --- a/packages/store/test/storage.spec.ts +++ b/packages/store/test/storage.spec.ts @@ -1,6 +1,7 @@ import MockDate from 'mockdate'; import nock from 'nock'; import * as httpMocks from 'node-mocks-http'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { API_ERROR, API_MESSAGE, DIST_TAGS, HEADERS, errorUtils, fileUtils } from '@verdaccio/core'; @@ -56,7 +57,7 @@ describe('storage', () => { beforeEach(() => { nock.cleanAll(); nock.abortPendingRequests(); - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('publishing commands', () => { diff --git a/packages/store/test/storage.sync.spec.ts b/packages/store/test/storage.sync.spec.ts index 6ef8c67a2..715f5adac 100644 --- a/packages/store/test/storage.sync.spec.ts +++ b/packages/store/test/storage.sync.spec.ts @@ -1,4 +1,5 @@ import nock from 'nock'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { API_ERROR, DIST_TAGS } from '@verdaccio/core'; @@ -22,7 +23,7 @@ describe('storage', () => { beforeEach(() => { nock.cleanAll(); nock.abortPendingRequests(); - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('syncUplinksMetadata()', () => { diff --git a/packages/store/test/storage.tarball.spec.ts b/packages/store/test/storage.tarball.spec.ts index 037b3c6e4..fcfa28e9d 100644 --- a/packages/store/test/storage.tarball.spec.ts +++ b/packages/store/test/storage.tarball.spec.ts @@ -1,6 +1,7 @@ import nock from 'nock'; import * as httpMocks from 'node-mocks-http'; import path from 'path'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { API_ERROR, HEADERS, HEADER_TYPE, errorUtils } from '@verdaccio/core'; @@ -23,7 +24,7 @@ describe('storage', () => { beforeEach(() => { nock.cleanAll(); nock.abortPendingRequests(); - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('getTarball', () => { diff --git a/packages/store/test/versions.spec.ts b/packages/store/test/versions.spec.ts index 30c37f573..5afab6fc3 100644 --- a/packages/store/test/versions.spec.ts +++ b/packages/store/test/versions.spec.ts @@ -1,4 +1,5 @@ import assert from 'assert'; +import { describe, expect, test } from 'vitest'; import { getVersion, @@ -118,7 +119,7 @@ describe('versions-utils', () => { }); describe('removeLowerVersions', () => { - it('should remove lower semantic versions', () => { + test('should remove lower semantic versions', () => { const inputArray = [ { package: { name: 'object1', version: '1.0.0' } }, { package: { name: 'object1', version: '2.0.0' } }, // Duplicate name 'object1' @@ -140,7 +141,7 @@ describe('versions-utils', () => { expect(result).toEqual(expectedOutput); }); - it('should remove lower semantic versions 2', () => { + test('should remove lower semantic versions 2', () => { const inputArray = [ { package: { name: 'object1', version: '1.0.0' } }, { package: { name: 'object1', version: '2.0.0' } }, // Duplicate name 'object1'