0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/unit/api/mock.js
2018-06-26 06:15:06 +02:00

18 lines
743 B
JavaScript

// @flow
import path from 'path';
import {DOMAIN_SERVERS} from '../../functional/config.functional';
import VerdaccioProcess from '../../lib/server_process';
import {VerdaccioConfig} from '../../lib/verdaccio-server';
import Server from '../../lib/server';
import type {IServerBridge} from '../../types';
export function mockServer(port: number) {
const pathStore = path.join(__dirname, '../partials');
const verdaccioConfig = new VerdaccioConfig(
path.join(pathStore, '/mock-store'),
path.join(pathStore, '/config-unit-test.yaml'), `http://${DOMAIN_SERVERS}:${port}/`, port);
const server: IServerBridge = new Server(verdaccioConfig.domainPath);
return new VerdaccioProcess(verdaccioConfig, server, false, false, false);
}