summaryrefslogtreecommitdiff
path: root/js/compiler.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-02-11 00:19:31 +0100
committerRyan Dahl <ry@tinyclouds.org>2019-02-10 18:19:31 -0500
commit1e837f3281413c7a9a3a27bb37b6829e3d2a85fa (patch)
tree3f683d4262ba02740d98a993d2a059b242eec9f3 /js/compiler.ts
parentfe8c5d358ba7765b591f4087232f16a6a60f420e (diff)
Respect NO_COLOR in TypeScript output (#1736)
Diffstat (limited to 'js/compiler.ts')
-rw-r--r--js/compiler.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/compiler.ts b/js/compiler.ts
index 904e38eba..85d808520 100644
--- a/js/compiler.ts
+++ b/js/compiler.ts
@@ -68,6 +68,7 @@ interface Ts {
createLanguageService: typeof ts.createLanguageService;
/* tslint:disable-next-line:max-line-length */
formatDiagnosticsWithColorAndContext: typeof ts.formatDiagnosticsWithColorAndContext;
+ formatDiagnostics: typeof ts.formatDiagnostics;
}
/** A simple object structure for caching resolved modules and their contents.
@@ -344,10 +345,10 @@ class Compiler implements ts.LanguageServiceHost, ts.FormatDiagnosticsHost {
...service.getSemanticDiagnostics(fileName)
];
if (diagnostics.length > 0) {
- const errMsg = this._ts.formatDiagnosticsWithColorAndContext(
- diagnostics,
- this
- );
+ const errMsg = os.noColor
+ ? this._ts.formatDiagnostics(diagnostics, this)
+ : this._ts.formatDiagnosticsWithColorAndContext(diagnostics, this);
+
console.log(errMsg);
// All TypeScript errors are terminal for deno
this._os.exit(1);