Skip to content

Commit

Permalink
chore: env in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed Apr 16, 2019
1 parent a33b860 commit 49c68e4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const moduleNameMapper = {

const transformIgnorePatterns = ['node_modules', 'lib'];
const moduleFileExtensions = ['js', 'json', 'jsx', 'node', 'jsx', 'ts', 'tsx'];
const testEnvironment = 'node';
const transform = {
'^.+\\.(ts|tsx)$': 'ts-jest',
};
Expand All @@ -24,6 +25,7 @@ module.exports = {
moduleFileExtensions,
transformIgnorePatterns,
moduleNameMapper,
testEnvironment,
globals: {
'ts-jest': {
tsConfig: '<rootDir>/packages/http-server/tsconfig.json',
Expand All @@ -37,6 +39,7 @@ module.exports = {
moduleFileExtensions,
transformIgnorePatterns,
moduleNameMapper,
testEnvironment,
globals: {
'ts-jest': {
tsConfig: '<rootDir>/packages/http/tsconfig.json',
Expand All @@ -50,6 +53,7 @@ module.exports = {
moduleFileExtensions,
transformIgnorePatterns,
moduleNameMapper,
testEnvironment,
globals: {
'ts-jest': {
tsConfig: '<rootDir>/packages/core/tsconfig.json',
Expand All @@ -63,6 +67,7 @@ module.exports = {
moduleFileExtensions,
transformIgnorePatterns,
moduleNameMapper,
testEnvironment,
globals: {
'ts-jest': {
tsConfig: '<rootDir>/packages/cli/tsconfig.json',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build.watch": "tsc --build --watch ./packages/tsconfig.build.json",
"posttest": "yarn lint",
"test": "yarn test.ci",
"test.ci": "jest --env=node --maxWorkers=2",
"test.ci": "jest --maxWorkers=2",
"test.coverage": "yarn test --coverage",
"test.watch": "yarn test --watchAll",
"test.update": "yarn test.fast --updateSnapshot",
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/util/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { createServer as createHttpServer } from '@stoplight/prism-http-server';

export function createServer(spec: string, config: IHttpConfig) {
return spec && isHttp(spec)
? createHttpServer({ url: spec }, { components: { loader: createHttpLoaderInstance() }, config })
? createHttpServer(
{ url: spec },
{ components: { loader: createHttpLoaderInstance() }, config }
)
: createHttpServer({ path: spec }, { config });
}

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export function factory<Resource, Input, Output, Config, LoadOpts>(
defaultConfig: PrismConfig<Config, Input>,
defaultComponents: Partial<IPrismComponents<Resource, Input, Output, Config, LoadOpts>>
): (
customConfig?: PartialPrismConfig<Config, Input>,
customComponents?: Partial<IPrismComponents<Resource, Input, Output, Config, LoadOpts>>
) => IPrism<Resource, Input, Output, Config, LoadOpts> {
customConfig?: PartialPrismConfig<Config, Input>,
customComponents?: Partial<IPrismComponents<Resource, Input, Output, Config, LoadOpts>>
) => IPrism<Resource, Input, Output, Config, LoadOpts> {
const prism = (
customConfig?: PartialPrismConfig<Config, Input>,
customComponents?: Partial<IPrismComponents<Resource, Input, Output, Config, LoadOpts>>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/loaders/filesystem/filesystemLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GraphFacade } from '../../utils/graphFacade';
const DEFAULT_PATH = '.';

export class FilesystemLoader {
constructor(private graphFacade: GraphFacade) { }
constructor(private graphFacade: GraphFacade) {}

/**
* TODO(sl-732): we can't assure we will return an array of 'Resource'.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/loaders/http/httpLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IHttpLoaderOpts } from '../../types';
import { GraphFacade } from '../../utils/graphFacade';

export class HttpLoader {
constructor(private graphFacade: GraphFacade) { }
constructor(private graphFacade: GraphFacade) {}

public async load(opts?: IHttpLoaderOpts): Promise<IHttpOperation[]> {
if (!opts || !opts.url) return [];
Expand Down
2 changes: 1 addition & 1 deletion packages/http/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { factory, createFilesystemLoaderInstance, PartialPrismConfig } from '@stoplight/prism-core';
import { createFilesystemLoaderInstance, factory, PartialPrismConfig } from '@stoplight/prism-core';
import { IHttpOperation } from '@stoplight/types';

import { forwarder } from './forwarder';
Expand Down

0 comments on commit 49c68e4

Please sign in to comment.