mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-08 23:25:51 +01:00
migrate vitest
This commit is contained in:
parent
42d62efeae
commit
c545b0ae5a
@ -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';
|
||||
@ -53,7 +52,7 @@ export async function asyncLoadPlugin<T extends pluginUtils.Plugin<T>>(
|
||||
prefix: string = 'verdaccio'
|
||||
): Promise<PluginType<T>[]> {
|
||||
const pluginsIds = Object.keys(pluginConfigs);
|
||||
const { config } = params;
|
||||
const { config, logger } = params;
|
||||
let plugins: PluginType<T>[] = [];
|
||||
for (let pluginId of pluginsIds) {
|
||||
debug('plugin %s', pluginId);
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
});
|
@ -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 { beforeEach, describe, expect, test } from 'vitest';
|
||||
|
||||
import { checkFunctionIsPromise, promisifiedCallbackFunction } from '../src/lib/legacy-utils';
|
||||
|
||||
describe('utils', () => {
|
||||
|
@ -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';
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { DIST_TAGS } from '@verdaccio/core';
|
||||
import { Manifest } from '@verdaccio/types';
|
||||
|
||||
|
@ -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', () => {
|
||||
|
@ -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', () => {
|
||||
|
@ -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';
|
||||
|
@ -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', () => {
|
||||
|
@ -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()', () => {
|
||||
|
@ -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', () => {
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user