Skip to content

Commit 7c772b2

Browse files
Merge branch 'master' of https://github.com/nestjs/nest
2 parents 7edf598 + bf04704 commit 7c772b2

6 files changed

Lines changed: 12 additions & 8 deletions

File tree

packages/common/interfaces/http/http-server.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface HttpServer {
3838
setErrorHandler?(handler: Function);
3939
setNotFoundHandler?(handler: Function);
4040
useStaticAssets?(...args: any[]): this;
41-
setBaseViewsDir?(path: string): this;
41+
setBaseViewsDir?(path: string | string[]): this;
4242
setViewEngine?(engineOrOptions: any): this;
4343
createMiddlewareFactory(
4444
method: RequestMethod,

packages/common/interfaces/nest-express-application.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export interface INestExpressApplication {
4343
useStaticAssets(path: string, options?: ServeStaticOptions): this;
4444

4545
/**
46-
* Sets a base directory for templates (views).
46+
* Sets one or multiple base directories for templates (views).
4747
* Example `app.setBaseViewsDir('views')`
4848
*
4949
* @returns {this}
5050
*/
51-
setBaseViewsDir(path: string): this;
51+
setBaseViewsDir(path: string | string[]): this;
5252

5353
/**
5454
* Sets a view engine for templates (views).

packages/common/services/logger.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,17 @@ export class Logger implements LoggerService {
7777
this.printMessage(message, clc.yellow, context, isTimeDiffEnabled);
7878
}
7979

80+
protected static isActive(): boolean {
81+
return Logger.contextEnvironment !== NestEnvironment.TEST;
82+
}
83+
8084
private static printMessage(
8185
message: any,
8286
color: (message: string) => string,
8387
context: string = '',
8488
isTimeDiffEnabled?: boolean,
8589
) {
86-
if (Logger.contextEnvironment === NestEnvironment.TEST) {
90+
if (!this.isActive()) {
8791
return;
8892
}
8993
const output = isObject(message) ? JSON.stringify(message, null, 2) : message;
@@ -108,7 +112,7 @@ export class Logger implements LoggerService {
108112
}
109113

110114
private static printStackTrace(trace: string) {
111-
if (this.contextEnvironment === NestEnvironment.TEST || !trace) {
115+
if (!this.isActive() || !trace) {
112116
return;
113117
}
114118
process.stdout.write(trace);

packages/core/adapters/express-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class ExpressAdapter implements HttpServer {
126126
return this.use(express.static(path, options));
127127
}
128128

129-
setBaseViewsDir(path: string) {
129+
setBaseViewsDir(path: string | string[]) {
130130
return this.set('views', path);
131131
}
132132

packages/core/nest-application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export class NestApplication extends NestApplicationContext
363363
return this;
364364
}
365365

366-
public setBaseViewsDir(path: string): this {
366+
public setBaseViewsDir(path: string | string[]): this {
367367
this.httpAdapter.setBaseViewsDir && this.httpAdapter.setBaseViewsDir(path);
368368
return this;
369369
}

packages/microservices/server/server-grpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
227227
const nameExtended = this.parseDeepServiceName(name, key);
228228
const deepDefinition = grpcDefinition[key];
229229

230-
const isServiceDefined = !isUndefined(deepDefinition.service);
230+
const isServiceDefined = deepDefinition && !isUndefined(deepDefinition.service);
231231
const isServiceBoolean = isServiceDefined
232232
? deepDefinition.service !== false
233233
: false;

0 commit comments

Comments
 (0)