1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/__helper/mock.js

26 lines
869 B
JavaScript
Raw Normal View History

2018-06-24 22:39:09 +02:00
// @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';
2019-05-19 21:37:43 +02:00
/**
*
* @param port
* @returns {VerdaccioProcess}
*/
2018-06-24 22:39:09 +02:00
export function mockServer(port: number) {
const pathStore = path.join(__dirname, '../partials');
2019-05-19 21:03:45 +02:00
const storePath = path.join(pathStore, '/mock-store');
const configPath = path.join(pathStore, '/config-unit-mock-server-test.yaml');
const verdaccioConfig = new VerdaccioConfig(storePath, configPath, `http://${DOMAIN_SERVERS}:${port}/`, port);
2018-06-24 22:39:09 +02:00
const server: IServerBridge = new Server(verdaccioConfig.domainPath);
return new VerdaccioProcess(verdaccioConfig, server, false, false, false);
}