diff --git a/packages/api/jest.config.js b/packages/api/jest.config.js deleted file mode 100644 index 7da7d2da8..000000000 --- a/packages/api/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, {}); diff --git a/packages/api/package.json b/packages/api/package.json index 301aea264..79535603d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -29,7 +29,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/api/test/integration/_helper.ts b/packages/api/test/integration/_helper.ts index 41a2b379c..a44b4d914 100644 --- a/packages/api/test/integration/_helper.ts +++ b/packages/api/test/integration/_helper.ts @@ -2,6 +2,7 @@ import { Application } from 'express'; import _ from 'lodash'; import path from 'path'; import supertest from 'supertest'; +import { expect } from 'vitest'; import { parseConfigFile } from '@verdaccio/config'; import { HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; diff --git a/packages/api/test/integration/distTag.spec.ts b/packages/api/test/integration/distTag.spec.ts index 23fa660b2..2ebf3b2e7 100644 --- a/packages/api/test/integration/distTag.spec.ts +++ b/packages/api/test/integration/distTag.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { beforeEach, describe, expect, test } from 'vitest'; import { API_MESSAGE, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; diff --git a/packages/api/test/integration/owner.spec.ts b/packages/api/test/integration/owner.spec.ts index 419ab0391..bf2a05579 100644 --- a/packages/api/test/integration/owner.spec.ts +++ b/packages/api/test/integration/owner.spec.ts @@ -1,5 +1,6 @@ /* eslint-disable jest/no-commented-out-tests */ import nock from 'nock'; +import { describe, expect, test } from 'vitest'; import { HTTP_STATUS } from '@verdaccio/core'; diff --git a/packages/api/test/integration/package.spec.ts b/packages/api/test/integration/package.spec.ts index c10f0d12b..d189fd32f 100644 --- a/packages/api/test/integration/package.spec.ts +++ b/packages/api/test/integration/package.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { beforeEach, describe, expect, test } from 'vitest'; import { DIST_TAGS, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; import { Storage } from '@verdaccio/store'; diff --git a/packages/api/test/integration/ping.spec.ts b/packages/api/test/integration/ping.spec.ts index 0cd2a262c..af5a5f7b9 100644 --- a/packages/api/test/integration/ping.spec.ts +++ b/packages/api/test/integration/ping.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { describe, expect, test } from 'vitest'; import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; diff --git a/packages/api/test/integration/profile.spec.ts b/packages/api/test/integration/profile.spec.ts index cbeafc522..9276a3c72 100644 --- a/packages/api/test/integration/profile.spec.ts +++ b/packages/api/test/integration/profile.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { describe, test } from 'vitest'; import { HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; import { buildToken } from '@verdaccio/utils'; diff --git a/packages/api/test/integration/publish.spec.ts b/packages/api/test/integration/publish.spec.ts index 53a73b6c2..111a23be6 100644 --- a/packages/api/test/integration/publish.spec.ts +++ b/packages/api/test/integration/publish.spec.ts @@ -1,6 +1,7 @@ import nock from 'nock'; import { basename } from 'path'; import supertest from 'supertest'; +import { describe, expect, test } from 'vitest'; import { HTTP_STATUS } from '@verdaccio/core'; import { API_ERROR, API_MESSAGE, HEADERS, HEADER_TYPE } from '@verdaccio/core'; diff --git a/packages/api/test/integration/search.spec.ts b/packages/api/test/integration/search.spec.ts index 41e8cef4f..2bb574c59 100644 --- a/packages/api/test/integration/search.spec.ts +++ b/packages/api/test/integration/search.spec.ts @@ -1,5 +1,6 @@ import MockDate from 'mockdate'; import supertest from 'supertest'; +import { beforeEach, describe, expect, test } from 'vitest'; import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core'; diff --git a/packages/api/test/integration/star.spec.ts b/packages/api/test/integration/star.spec.ts index b8c02c5fe..a58cc1ed3 100644 --- a/packages/api/test/integration/star.spec.ts +++ b/packages/api/test/integration/star.spec.ts @@ -1,5 +1,6 @@ import nock from 'nock'; import supertest from 'supertest'; +import { describe, expect, test } from 'vitest'; import { HTTP_STATUS } from '@verdaccio/core'; import { HEADERS, HEADER_TYPE } from '@verdaccio/core'; diff --git a/packages/api/test/integration/token.spec.ts b/packages/api/test/integration/token.spec.ts index aa60bc3ce..88e1f5d27 100644 --- a/packages/api/test/integration/token.spec.ts +++ b/packages/api/test/integration/token.spec.ts @@ -1,5 +1,6 @@ import _ from 'lodash'; import supertest from 'supertest'; +import { describe, expect, test } from 'vitest'; import { API_ERROR, diff --git a/packages/api/test/integration/user.spec.ts b/packages/api/test/integration/user.spec.ts index ae1b4ec9c..8acba45b8 100644 --- a/packages/api/test/integration/user.spec.ts +++ b/packages/api/test/integration/user.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { describe, expect, test, vi } from 'vitest'; import { API_ERROR, HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; import { buildToken } from '@verdaccio/utils'; @@ -7,7 +8,7 @@ import { createUser, getPackage, initializeServer } from './_helper'; const FORBIDDEN_VUE = 'authorization required to access package vue'; -jest.setTimeout(20000); +vi.setConfig({ testTimeout: 20000 }); describe('token', () => { describe('basics', () => { diff --git a/packages/api/test/integration/whoami.spec.ts b/packages/api/test/integration/whoami.spec.ts index 4fb3ddb64..9d5caba46 100644 --- a/packages/api/test/integration/whoami.spec.ts +++ b/packages/api/test/integration/whoami.spec.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; +import { describe, expect, test } from 'vitest'; import { HEADERS, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core'; import { buildToken } from '@verdaccio/utils'; diff --git a/packages/api/test/unit/validate.api.params.middleware.spec.ts b/packages/api/test/unit/validate.api.params.middleware.spec.ts index 3cfc32585..9661ac231 100644 --- a/packages/api/test/unit/validate.api.params.middleware.spec.ts +++ b/packages/api/test/unit/validate.api.params.middleware.spec.ts @@ -2,6 +2,7 @@ // ensure that all arguments are validated import fs from 'fs'; import path from 'path'; +import { describe, expect, test } from 'vitest'; /** * Validate. diff --git a/packages/plugins/local-storage/jest.config.js b/packages/plugins/local-storage/jest.config.js deleted file mode 100644 index ea189b943..000000000 --- a/packages/plugins/local-storage/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: 51, - }, - }, -}); diff --git a/packages/plugins/local-storage/package.json b/packages/plugins/local-storage/package.json index 831ca212e..6907a63c6 100644 --- a/packages/plugins/local-storage/package.json +++ b/packages/plugins/local-storage/package.json @@ -58,7 +58,7 @@ }, "scripts": { "clean": "rimraf ./build", - "test": "jest --runInBand", + "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/plugins/local-storage/tests/dir-utils.test.ts b/packages/plugins/local-storage/tests/dir-utils.test.ts index 391cbc6fc..845572a7b 100644 --- a/packages/plugins/local-storage/tests/dir-utils.test.ts +++ b/packages/plugins/local-storage/tests/dir-utils.test.ts @@ -1,4 +1,5 @@ import { join } from 'path'; +import { describe, expect, test } from 'vitest'; import { getFolders, searchOnStorage } from '../src/dir-utils'; diff --git a/packages/plugins/local-storage/tests/local-database.test.ts b/packages/plugins/local-storage/tests/local-database.test.ts index 789c5f6e8..ed3a6437a 100644 --- a/packages/plugins/local-storage/tests/local-database.test.ts +++ b/packages/plugins/local-storage/tests/local-database.test.ts @@ -1,22 +1,23 @@ /* eslint-disable jest/no-mocks-import */ import path from 'path'; +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { fileUtils, pluginUtils } from '@verdaccio/core'; import { logger, setup } from '@verdaccio/logger'; import LocalDatabase, { ERROR_DB_LOCKED } from '../src/local-database'; -const mockWrite = jest.fn(() => Promise.resolve()); -const mockmkdir = jest.fn(() => Promise.resolve()); -const mockRead = jest.fn(() => Promise.resolve()); +const mockWrite = vi.fn(() => Promise.resolve()); +const mockmkdir = vi.fn(() => Promise.resolve()); +const mockRead = vi.fn(() => Promise.resolve()); -jest.mock('../src/fs', () => ({ +vi.mock('../src/fs', () => ({ mkdirPromise: () => mockRead(), readFilePromise: () => mockmkdir(), writeFilePromise: () => mockWrite(), })); -setup(); +setup({}); const optionsPlugin: pluginUtils.PluginOptions = { logger, @@ -31,7 +32,6 @@ describe('Local Database', () => { beforeEach(async () => { tmpFolder = await fileUtils.createTempFolder('local-storage-plugin-'); const tempFolder = path.join(tmpFolder, 'verdaccio-test.yaml'); - // @ts-expect-error locaDatabase = new LocalDatabase( // @ts-expect-error { @@ -46,8 +46,8 @@ describe('Local Database', () => { }); afterEach(() => { - jest.resetAllMocks(); - jest.clearAllMocks(); + vi.resetAllMocks(); + vi.clearAllMocks(); }); test('should create an instance', () => { diff --git a/packages/plugins/local-storage/tests/local-fs.test.ts b/packages/plugins/local-storage/tests/local-fs.test.ts index e8fa99526..9534729a0 100644 --- a/packages/plugins/local-storage/tests/local-fs.test.ts +++ b/packages/plugins/local-storage/tests/local-fs.test.ts @@ -1,10 +1,11 @@ import fs from 'fs'; import path from 'path'; import { Readable } from 'stream'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { fileUtils } from '@verdaccio/core'; import { createTempFolder } from '@verdaccio/test-helper'; -import { ILocalPackageManager, Logger, Manifest } from '@verdaccio/types'; +import { Logger, Manifest } from '@verdaccio/types'; import LocalDriver from '../src/local-fs'; import pkg from './__fixtures__/pkg'; @@ -21,15 +22,17 @@ function checkFileExists(filepath) { } const logger: Logger = { - error: jest.fn(), - info: jest.fn(), - debug: jest.fn(), - child: jest.fn(), - warn: jest.fn(), - http: jest.fn(), - trace: jest.fn(), + error: vi.fn(), + info: vi.fn(), + debug: vi.fn(), + child: vi.fn(), + warn: vi.fn(), + http: vi.fn(), + trace: vi.fn(), }; +vi.setConfig({ testTimeout: 20000 }); + describe('Local FS test', () => { let tmpFolder; beforeEach(async () => { @@ -40,7 +43,7 @@ describe('Local FS test', () => { describe.skip('deletePackage() group', () => { test('should delete a package', async () => { const localFs = new LocalDriver(path.join(localTempStorage, 'createPackage'), logger); - await localFs.createPackag('createPackage', pkg as unknown as Manifest); + await localFs.createPackage('createPackage', pkg as unknown as Manifest); // verdaccio removes the package.json instead the package name await localFs.deletePackage('package.json'); // verify if the `package.json` does not exist anymore @@ -60,119 +63,119 @@ describe('Local FS test', () => { }); test('should successfully remove the package', async () => { - const localFs: ILocalPackageManager = new LocalDriver( - path.join(localTempStorage, '_toDelete'), - logger - ); + const localFs = new LocalDriver(path.join(localTempStorage, '_toDelete'), logger); await expect(localFs.removePackage()).resolves.toBeUndefined(); }); test('removePackage() fails', async () => { - const localFs: ILocalPackageManager = new LocalDriver( - path.join(localTempStorage, '_toDelete_fake'), - logger - ); + const localFs = new LocalDriver(path.join(localTempStorage, '_toDelete_fake'), logger); await expect(localFs.removePackage()).rejects.toThrow(/ENOENT/); }); }); describe('writeTarballNext', () => { - test('should write a tarball', (done) => { - const abort = new AbortController(); - const tmp = createTempFolder('local-fs-write-tarball'); - const localFs = new LocalDriver(tmp, logger); - const readableStream = Readable.from('foooo'); - // TODO: verify file exist - localFs.writeTarball('juan-1.0.0.tgz', { signal: abort.signal }).then((stream) => { - stream.on('finish', () => { - done(); + test('should write a tarball', () => + new Promise((done) => { + const abort = new AbortController(); + const tmp = createTempFolder('local-fs-write-tarball'); + const localFs = new LocalDriver(tmp, logger); + const readableStream = Readable.from('foooo'); + // TODO: verify file exist + localFs.writeTarball('juan-1.0.0.tgz', { signal: abort.signal }).then((stream) => { + stream.on('finish', () => { + done(true); + }); + readableStream.pipe(stream); }); - readableStream.pipe(stream); - }); - }); + })); }); describe('writeTarballNextNoFolder', () => { - test('should write a tarball even if folder does not exist', (done) => { - const abort = new AbortController(); - const tmp = path.join(localTempStorage, 'local-fs-write-tarball-new-folder'); - const localFs = new LocalDriver(tmp, logger); - const readableStream = Readable.from('foooo'); - localFs.writeTarball('juan-1.0.0.tgz', { signal: abort.signal }).then((stream) => { - stream.on('finish', () => { - done(); + test('should write a tarball even if folder does not exist', () => + new Promise((done) => { + const abort = new AbortController(); + const tmp = path.join(localTempStorage, 'local-fs-write-tarball-new-folder'); + const localFs = new LocalDriver(tmp, logger); + const readableStream = Readable.from('foooo'); + localFs.writeTarball('juan-1.0.0.tgz', { signal: abort.signal }).then((stream) => { + stream.on('finish', () => { + done(true); + }); + readableStream.pipe(stream); }); - readableStream.pipe(stream); - }); - }); + })); }); describe('readTarballNext', () => { - test('should read a tarball', (done) => { - const abort = new AbortController(); - const localFs = new LocalDriver( - path.join(__dirname, '__fixtures__/readme-test-next'), - logger - ); - localFs.readTarball('test-readme-0.0.1.tgz', { signal: abort.signal }).then((stream) => { - stream.on('data', (data) => { - expect(data.length).toEqual(352); + test('should read a tarball', () => + new Promise((done) => { + const abort = new AbortController(); + const localFs = new LocalDriver( + path.join(__dirname, '__fixtures__/readme-test-next'), + logger + ); + localFs.readTarball('test-readme-0.0.1.tgz', { signal: abort.signal }).then((stream) => { + stream.on('data', (data) => { + expect(data.length).toEqual(352); + }); + stream.on('end', () => { + done(true); + }); }); - stream.on('end', () => { - done(); - }); - }); - }); + })); - test('should abort read a tarball', (done) => { - const abort = new AbortController(); - const localFs = new LocalDriver( - path.join(__dirname, '__fixtures__/readme-test-next'), - logger - ); - localFs.readTarball('test-readme-0.0.3.tgz', { signal: abort.signal }).then((stream) => { - stream.on('error', (error: any) => { - // FIXME: might be different results sometimes, need research - // expect(error.code).toEqual('ABORT_ERR'); - expect(error).toBeDefined(); - done(); + test('should abort read a tarball', () => + new Promise((done) => { + const abort = new AbortController(); + const localFs = new LocalDriver( + path.join(__dirname, '__fixtures__/readme-test-next'), + logger + ); + localFs.readTarball('test-readme-0.0.3.tgz', { signal: abort.signal }).then((stream) => { + stream.on('error', (error: any) => { + // FIXME: might be different results sometimes, need research + // expect(error.code).toEqual('ABORT_ERR'); + expect(error).toBeDefined(); + done(true); + }); + abort.abort(); }); - abort.abort(); - }); - }); + })); - test('fails on read a tarball doex not exist', (done) => { - const abort = new AbortController(); + test('fails on read a tarball doex not exist', () => + new Promise((done) => { + const abort = new AbortController(); - const localFs = new LocalDriver( - path.join(__dirname, '__fixtures__/readme-test-next'), - logger - ); - localFs.readTarball('does-not-exist-0.0.0.tgz', { signal: abort.signal }).then((stream) => { - stream.on('error', (error: any) => { - expect(error.code).toEqual('ENOENT'); - done(); + const localFs = new LocalDriver( + path.join(__dirname, '__fixtures__/readme-test-next'), + logger + ); + localFs.readTarball('does-not-exist-0.0.0.tgz', { signal: abort.signal }).then((stream) => { + stream.on('error', (error: any) => { + expect(error.code).toEqual('ENOENT'); + done(true); + }); }); - }); - }); + })); - test('should return content-length', (done) => { - const localFs = new LocalDriver( - path.join(__dirname, '__fixtures__/readme-test-next'), - logger - ); - const abort = new AbortController(); - localFs.readTarball('test-readme-0.0.0.tgz', { signal: abort.signal }).then((stream) => { - stream.on('data', (data) => { - expect(data.length).toEqual(352); - }); + test('should return content-length', () => + new Promise((done) => { + const localFs = new LocalDriver( + path.join(__dirname, '__fixtures__/readme-test-next'), + logger + ); + const abort = new AbortController(); + localFs.readTarball('test-readme-0.0.0.tgz', { signal: abort.signal }).then((stream) => { + stream.on('data', (data) => { + expect(data.length).toEqual(352); + }); - stream.on('content-length', (content) => { - expect(content).toEqual(352); - done(); + stream.on('content-length', (content) => { + expect(content).toEqual(352); + done(true); + }); }); - }); - }, 100000); + })); }); }); diff --git a/packages/plugins/local-storage/tests/token.test.ts b/packages/plugins/local-storage/tests/token.test.ts index 1a136ceb6..f652e004a 100644 --- a/packages/plugins/local-storage/tests/token.test.ts +++ b/packages/plugins/local-storage/tests/token.test.ts @@ -1,6 +1,7 @@ /* eslint-disable jest/no-mocks-import */ import fs from 'fs'; import path from 'path'; +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { fileUtils } from '@verdaccio/core'; import { Logger, Token } from '@verdaccio/types'; @@ -8,13 +9,13 @@ import { Logger, Token } from '@verdaccio/types'; import LocalDatabase from '../src/local-database'; const logger: Logger = { - error: jest.fn(), - info: jest.fn(), - debug: jest.fn(), - child: jest.fn(), - warn: jest.fn(), - http: jest.fn(), - trace: jest.fn(), + error: vi.fn(), + info: vi.fn(), + debug: vi.fn(), + child: vi.fn(), + warn: vi.fn(), + http: vi.fn(), + trace: vi.fn(), }; describe('Local Database', () => { @@ -23,7 +24,7 @@ describe('Local Database', () => { beforeEach(async () => { tmpFolder = await fileUtils.createTempFolder('local-storage-plugin-'); const tempFolder = path.join(tmpFolder, 'verdaccio-test.yaml'); - const writeMock = jest.spyOn(fs, 'writeFileSync').mockImplementation(); + const writeMock = vi.spyOn(fs, 'writeFileSync').mockImplementation(() => {}); locaDatabase = new LocalDatabase( // @ts-expect-error { storage: 'storage', @@ -38,7 +39,7 @@ describe('Local Database', () => { }); afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); describe('token', () => { diff --git a/packages/plugins/local-storage/tests/utils.test.ts b/packages/plugins/local-storage/tests/utils.test.ts index 81a581f44..7e97d63a6 100644 --- a/packages/plugins/local-storage/tests/utils.test.ts +++ b/packages/plugins/local-storage/tests/utils.test.ts @@ -1,4 +1,5 @@ import path from 'path'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { Logger } from '@verdaccio/types'; @@ -8,20 +9,20 @@ import { loadPrivatePackages } from '../src/pkg-utils'; import { _dbGenPath, findPackages } from '../src/utils'; const logger: Logger = { - error: jest.fn(), - info: jest.fn(), - debug: jest.fn(), - child: jest.fn(), - warn: jest.fn(), - http: jest.fn(), - trace: jest.fn(), + error: vi.fn(), + info: vi.fn(), + debug: vi.fn(), + child: vi.fn(), + warn: vi.fn(), + http: vi.fn(), + trace: vi.fn(), }; describe('Utitlies', () => { const loadDb = (name): string => path.join(__dirname, '__fixtures__/databases', `${name}.json`); beforeEach(() => { - jest.resetModules(); + vi.resetModules(); }); test('should load private packages', async () => { @@ -45,7 +46,7 @@ describe('Utitlies', () => { }); test('should handle null read values and return empty database', async () => { - const spy = jest.spyOn(readFile, 'readFilePromise'); + const spy = vi.spyOn(readFile, 'readFilePromise'); spy.mockResolvedValue(null); const database = loadDb('ok'); const db = await loadPrivatePackages(database, logger); @@ -60,7 +61,7 @@ describe('Utitlies', () => { try { await findPackages( './no_such_folder_fake', - jest.fn(() => true) + vi.fn(() => true) ); } catch (e: any) { expect(e.code).toEqual(noSuchFile); @@ -69,7 +70,7 @@ describe('Utitlies', () => { test('should fetch all packages from valid storage', async () => { const storage = path.join(__dirname, '__fixtures__/findPackages'); - const validator = jest.fn((file) => file.indexOf('.') === -1); + const validator = vi.fn((file) => file.indexOf('.') === -1); const pkgs = await findPackages(storage, validator); // the result is 7 due number of packages on "findPackages" directory expect(pkgs).toHaveLength(5); @@ -82,7 +83,7 @@ describe('Utitlies', () => { expect( _dbGenPath('local.db', { storage: './storage', - config_path: '/etc/foo/config.yaml', + configPath: '/etc/foo/config.yaml', }) ).toMatch('local.db'); }); @@ -91,7 +92,7 @@ describe('Utitlies', () => { expect( _dbGenPath('local.db', { storage: '', - config_path: '/etc/foo/config.yaml', + configPath: '/etc/foo/config.yaml', }) ).toMatch('local.db'); }); @@ -100,7 +101,7 @@ describe('Utitlies', () => { expect( _dbGenPath('local.db', { storage: '', - config_path: '/etc/foo/config.yaml', + configPath: '/etc/foo/config.yaml', }) ).toMatch('local.db'); }); @@ -109,7 +110,8 @@ describe('Utitlies', () => { expect( _dbGenPath('local.db', { storage: './storage', - config_path: undefined, + // @ts-expect-error + configPath: undefined, }) ).toMatch('local.db'); }); diff --git a/packages/search/jest.config.js b/packages/search/jest.config.js deleted file mode 100644 index 2d4d07822..000000000 --- a/packages/search/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const config = require('../../jest/config'); - -module.exports = Object.assign({}, config, { - coverageThreshold: { - global: { - branches: 0, - functions: 0, - lines: 0, - }, - }, -}); diff --git a/packages/search/package.json b/packages/search/package.json index 81c14f5f5..207501b90 100644 --- a/packages/search/package.json +++ b/packages/search/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/search/test/search.test.ts b/packages/search/test/search.test.ts index f8d50c153..4cdba1a2e 100644 --- a/packages/search/test/search.test.ts +++ b/packages/search/test/search.test.ts @@ -1,4 +1,5 @@ import nock from 'nock'; +import { describe, expect, test } from 'vitest'; import { Config, getDefaultConfig } from '@verdaccio/config'; import { logger, setup } from '@verdaccio/logger'; diff --git a/packages/server/express/src/server.ts b/packages/server/express/src/server.ts index d94e8d548..a20319291 100644 --- a/packages/server/express/src/server.ts +++ b/packages/server/express/src/server.ts @@ -144,7 +144,7 @@ export default (async function startServer(configHash: ConfigYaml): Promise // register middleware plugins debug('loaded filter plugin'); // @ts-ignore - const storage: Storage = new Storage(config); + const storage: Storage = new Storage(config, logger); try { // waits until init calls have been initialized debug('storage init start'); diff --git a/packages/server/fastify/src/plugins/storage.ts b/packages/server/fastify/src/plugins/storage.ts index 14b8807ce..b6f8206a1 100644 --- a/packages/server/fastify/src/plugins/storage.ts +++ b/packages/server/fastify/src/plugins/storage.ts @@ -1,13 +1,14 @@ import { FastifyInstance } from 'fastify'; import fp from 'fastify-plugin'; +import { logger } from '@verdaccio/logger'; import { Storage } from '@verdaccio/store'; import { Config as IConfig } from '@verdaccio/types'; export default fp( async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) { const { config } = opts; - const storage: Storage = new Storage(config); + const storage: Storage = new Storage(config, logger); // @ts-ignore await storage.init(config, []); fastify.decorate('storage', storage); diff --git a/packages/store/src/storage.ts b/packages/store/src/storage.ts index 3d9094efa..068039369 100644 --- a/packages/store/src/storage.ts +++ b/packages/store/src/storage.ts @@ -24,7 +24,6 @@ import { validatioUtils, } from '@verdaccio/core'; import { asyncLoadPlugin } from '@verdaccio/loaders'; -import { logger } from '@verdaccio/logger'; import { IProxy, ISyncUplinksOptions, @@ -101,7 +100,7 @@ class Storage { public readonly logger: Logger; public readonly uplinks: ProxyInstanceList; private searchService: Search; - public constructor(config: Config) { + public constructor(config: Config, logger: Logger) { this.config = config; this.logger = logger.child({ module: 'storage' }); this.uplinks = setupUpLinks(config, this.logger); @@ -501,7 +500,7 @@ class Storage { try { await this.checkAllowedToChangePackage(manifest, options.requestOptions.username); } catch (error: any) { - logger.error({ error: error.message }, 'getting package has failed: @{error}'); + this.logger.error({ error: error.message }, 'getting package has failed: @{error}'); throw errorUtils.getBadRequest(error.message); } } @@ -647,7 +646,7 @@ class Storage { */ public async init(config: Config): Promise { if (this.localStorage === null) { - this.localStorage = new LocalStorage(this.config, logger); + this.localStorage = new LocalStorage(this.config, this.logger); await this.localStorage.init(); debug('local init storage initialized'); await this.localStorage.getSecret(config); @@ -713,13 +712,13 @@ class Storage { return results; } - logger.info( + this.logger.info( { t: query.text, q: query.quality, p: query.popularity, m: query.maintenance, s: query.size }, 'search by text @{t}| maintenance @{m}| quality @{q}| popularity @{p}' ); if (typeof this.localStorage.getStoragePlugin().search === 'undefined') { - logger.info('plugin search not implemented yet'); + this.logger.info('plugin search not implemented yet'); } else { debug('search on each package by plugin query'); const items = await this.localStorage.getStoragePlugin().search(query); @@ -768,10 +767,10 @@ class Storage { manifest = normalizePackage(manifest); } catch (err: any) { if (err.code === STORAGE.NO_SUCH_FILE_ERROR || err.code === HTTP_STATUS.NOT_FOUND) { - logger.info({ pkgName, revision }, 'package not found'); + this.logger.info({ pkgName, revision }, 'package not found'); throw errorUtils.getNotFound(); } - logger.error( + this.logger.error( { pkgName, revision, err: err.message }, 'error @{err} while reading package @{pkgName}-{revision}' ); @@ -790,7 +789,7 @@ class Storage { for (let attachment of attachments) { debug('remove attachment %s', attachment); await storage.deletePackage(attachment); - logger.info({ attachment }, 'attachment @{attachment} removed'); + this.logger.info({ attachment }, 'attachment @{attachment} removed'); } // remove package.json debug('remove package.json'); @@ -798,7 +797,7 @@ class Storage { // remove folder debug('remove package folder'); await storage.removePackage(); - logger.info({ pkgName }, 'package @{pkgName} removed'); + this.logger.info({ pkgName }, 'package @{pkgName} removed'); } catch (err: any) { this.logger.error({ err }, 'removed package has failed @{err.message}'); throw errorUtils.getBadData(err.message); @@ -897,7 +896,7 @@ class Storage { cache: true, }, this.config, - logger + this.logger ); } return uplink; @@ -944,14 +943,14 @@ class Storage { try { const { name } = mergedManifest; await this.notify(mergedManifest, `${name}@${version}`); - logger.info({ name, version }, 'notify for @{name}@@{version} has been sent'); + this.logger.info({ name, version }, 'notify for @{name}@@{version} has been sent'); } catch (error: any) { - logger.error({ error: error.message }, 'notify batch service has failed: @{error}'); + this.logger.error({ error: error.message }, 'notify batch service has failed: @{error}'); } return message; } else { debug('invalid body format'); - logger.warn( + this.logger.warn( { packageName: options.name }, `wrong package format on publish a package @{packageName}` ); @@ -1146,7 +1145,7 @@ class Storage { } } catch (err: any) { debug('error on change or update a package with %o', err.message); - logger.error({ err: err.message }, 'error on publish new version: @{err}'); + this.logger.error({ err: err.message }, 'error on publish new version: @{err}'); throw err; } @@ -1161,7 +1160,7 @@ class Storage { // addVersion will move the readme from the the published version to the root level await this.addVersion(name, versionToPublish, versions[versionToPublish], null, tarballStats); } catch (err: any) { - logger.error({ err: err.message }, 'updated version has failed: @{err}'); + this.logger.error({ err: err.message }, 'updated version has failed: @{err}'); debug('error on create a version for %o with error %o', name, err.message); throw err; } @@ -1176,7 +1175,7 @@ class Storage { // 4. update once to the storage (easy peasy) mergedManifest = await this.mergeTagsNext(name, manifest[DIST_TAGS]); } catch (err: any) { - logger.error({ err: err.message }, 'merge version has failed: @{err}'); + this.logger.error({ err: err.message }, 'merge version has failed: @{err}'); debug('error on create a version for %o with error %o', name, err.message); // TODO: undo if this fails // 1. remove updated version @@ -1190,14 +1189,14 @@ class Storage { signal: options.signal, }); } catch (err: any) { - logger.error({ err: err.message }, 'upload tarball has failed: @{err}'); + this.logger.error({ err: err.message }, 'upload tarball has failed: @{err}'); // TODO: undo if this fails // 1. remove updated version // 2. remove new dist tags throw err; } - logger.info( + this.logger.info( { name, version: versionToPublish }, 'package @{name}@@{version} has been published' ); @@ -2028,7 +2027,7 @@ class Storage { manifest.maintainers.length > 0 && !manifest.maintainers.some((maintainer) => maintainer.name === username) ) { - logger.error({ username }, '@{username} is not a maintainer (package owner)'); + this.logger.error({ username }, '@{username} is not a maintainer (package owner)'); throw Error('only owners are allowed to change package'); } } diff --git a/packages/store/test/search.spec.ts b/packages/store/test/search.spec.ts index 9ce02f058..70a618471 100644 --- a/packages/store/test/search.spec.ts +++ b/packages/store/test/search.spec.ts @@ -8,7 +8,7 @@ import { generatePackageMetadata } from '@verdaccio/test-helper'; import { Storage } from '../src'; -setup({}); +const logger = setup({}); describe('search', () => { describe('search manager utils', () => { @@ -39,7 +39,7 @@ describe('search', () => { ...getDefaultConfig(), storage: await fileUtils.createTempStorageFolder('fix-1'), }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const abort = new AbortController(); const pkgName = 'verdaccio'; diff --git a/packages/store/test/storage.spec.ts b/packages/store/test/storage.spec.ts index a1624c9a0..7fc6d4fe4 100644 --- a/packages/store/test/storage.spec.ts +++ b/packages/store/test/storage.spec.ts @@ -44,7 +44,7 @@ function generateRandomStorage() { return path.join(tempRoot, tempStorage); } -setup({ type: 'stdout', format: 'pretty', level: 'trace' }); +const logger = setup({ type: 'stdout', format: 'pretty', level: 'trace' }); const domain = 'https://registry.npmjs.org'; const fakeHost = 'localhost:4873'; @@ -149,7 +149,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -194,7 +194,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const ac = new AbortController(); setTimeout(() => { @@ -239,7 +239,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); // create a package const bodyNewManifest1 = generatePackageMetadata(pkgName, '1.0.0'); @@ -328,7 +328,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest1 = generatePackageMetadata(pkgName, '1.0.0'); const bodyNewManifest2 = generatePackageMetadata(pkgName, '1.0.0'); @@ -365,7 +365,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -395,7 +395,7 @@ describe('storage', () => { const mockDate = '2018-01-14T11:17:40.712Z'; MockDate.set(mockDate); const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -442,7 +442,7 @@ describe('storage', () => { const mockDate = '2018-01-14T11:17:40.712Z'; MockDate.set(mockDate); const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); // publish new package const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -516,7 +516,7 @@ describe('storage', () => { describe('star', () => { test.each([['foo']])('star package %s', async (pkgName) => { const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -549,7 +549,7 @@ describe('storage', () => { const mockDate = '2018-01-14T11:17:40.712Z'; MockDate.set(mockDate); const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -591,7 +591,7 @@ describe('storage', () => { const mockDate = '2018-01-14T11:17:40.712Z'; MockDate.set(mockDate); const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -630,7 +630,7 @@ describe('storage', () => { test.each([['foo']])('should unstar a package %s', async (pkgName) => { const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -667,7 +667,7 @@ describe('storage', () => { test.each([['foo']])('should handle missing username %s', async (pkgName) => { const config = getConfig('deprecate.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -695,7 +695,7 @@ describe('storage', () => { ['foo', 'publishWithOwnerAndCheck.yaml'], ])('new package %s, %s (anonymous)', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); await storage.updateManifest(bodyNewManifest, { @@ -717,7 +717,7 @@ describe('storage', () => { ['foo', 'publishWithOwnerAndCheck.yaml'], ])('new package %s, %s (logged in)', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const owner = { name: 'fooUser', email: '' }; const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -742,7 +742,7 @@ describe('storage', () => { ['foo', 'publishWithOwnerAndCheck.yaml'], ])('add/remove owner %s, %s', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const firstOwner = { name: 'fooUser', email: '' }; const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -802,7 +802,7 @@ describe('storage', () => { ['foo', 'publishWithOwnerAndCheck.yaml'], ])('should fail removing last owner %s, %s', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); const owner = 'fooUser'; @@ -830,7 +830,7 @@ describe('storage', () => { 'ok to publish as non-owner without check %s, %s', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); const owner = 'fooUser'; @@ -860,7 +860,7 @@ describe('storage', () => { 'should fail publishing as non-owner with check %s, %s', async (pkgName, configFile) => { const config = getConfig(configFile); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); const owner = 'fooUser'; @@ -898,7 +898,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const ac = new AbortController(); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -938,7 +938,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const abort = new AbortController(); storage @@ -978,7 +978,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const abort = new AbortController(); storage @@ -1022,7 +1022,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const ac = new AbortController(); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -1086,7 +1086,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const req = httpMocks.createRequest({ method: 'GET', @@ -1139,7 +1139,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); storage.init(config).then(() => { const ac = new AbortController(); const bodyNewManifest = generatePackageMetadata(pkgName, '1.0.0'); @@ -1196,7 +1196,7 @@ describe('storage', () => { ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.syncUplinksMetadata(fooManifest.name, null, { @@ -1220,7 +1220,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.syncUplinksMetadata(fooManifest.name, null, { @@ -1241,7 +1241,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [manifest] = await storage.syncUplinksMetadata(fooManifest.name, fooManifest, { retry: { limit: 0 }, @@ -1263,7 +1263,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [response] = await storage.syncUplinksMetadata(fooManifest.name, fooManifest); @@ -1304,7 +1304,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [response] = await storage.syncUplinksMetadata(fooManifest.name, null); @@ -1326,7 +1326,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [response] = await storage.syncUplinksMetadata(fooManifest.name, fooManifest); @@ -1350,7 +1350,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [response] = await storage.syncUplinksMetadata(fooManifest.name, fooManifest, { @@ -1379,7 +1379,7 @@ describe('storage', () => { __dirname ) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const [response] = await storage.syncUplinksMetadata('foo', null, { @@ -1400,7 +1400,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect(storage.getLocalDatabase()).resolves.toHaveLength(0); }); @@ -1420,7 +1420,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const manifest = generatePackageMetadata('foo'); const ac = new AbortController(); @@ -1449,7 +1449,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await storage.saveToken({ user: 'foo', @@ -1471,7 +1471,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await storage.saveToken({ user: 'foo', @@ -1498,7 +1498,7 @@ describe('storage', () => { storage: generateRandomStorage(), }) ); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect(storage.removeTarball('foo', 'foo-1.0.0.tgz', 'rev', username)).rejects.toThrow( API_ERROR.NO_PACKAGE @@ -1524,7 +1524,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const manifest = generatePackageMetadata('foo'); @@ -1573,7 +1573,7 @@ describe('storage', () => { test('ok to remove package as non-owner without check', async () => { const config = getConfig('publishWithOwnerDefault.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const owner = 'fooUser'; const options = { ...defaultRequestOptions, username: owner }; @@ -1612,7 +1612,7 @@ describe('storage', () => { test('should fail as non-owner with check', async () => { const config = getConfig('publishWithOwnerAndCheck.yaml'); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const owner = 'fooUser'; const options = { ...defaultRequestOptions, username: owner }; @@ -1661,7 +1661,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1693,7 +1693,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1726,7 +1726,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1759,7 +1759,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1799,7 +1799,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1839,7 +1839,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); await expect( storage.getPackageByOptions({ @@ -1873,7 +1873,7 @@ describe('storage', () => { }, url: '/', }); - const storage = new Storage(config); + const storage = new Storage(config, logger); await storage.init(config); const manifest = (await storage.getPackageByOptions({ diff --git a/packages/tools/helpers/src/initializeServer.ts b/packages/tools/helpers/src/initializeServer.ts index 68e67ba70..9d26203ec 100644 --- a/packages/tools/helpers/src/initializeServer.ts +++ b/packages/tools/helpers/src/initializeServer.ts @@ -6,7 +6,7 @@ import path from 'path'; import { Auth } from '@verdaccio/auth'; import { Config } from '@verdaccio/config'; import { errorUtils } from '@verdaccio/core'; -import { logger } from '@verdaccio/logger'; +import { setup } from '@verdaccio/logger'; import { errorReportingMiddleware, final, handleError } from '@verdaccio/middleware'; import { generateRandomHexString } from '@verdaccio/utils'; @@ -18,13 +18,15 @@ export async function initializeServer( Storage ): Promise { const app = express(); + const logger = setup({}); const config = new Config(configName); config.storage = path.join(os.tmpdir(), '/storage', generateRandomHexString()); // httpass would get path.basename() for configPath thus we need to create a dummy folder // to avoid conflics config.configPath = config.storage; debug('storage: %s', config.storage); - const storage = new Storage(config); + + const storage = new Storage(config, logger); await storage.init(config, []); const auth: Auth = new Auth(config); await auth.init();