Skip to content

Commit 5a43307

Browse files
committed
fix: disable color when needed
1 parent fc2d5a7 commit 5a43307

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

crates/rspack_error/src/diagnostic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ impl Diagnostic {
177177
.with_theme(theme)
178178
.with_context_lines(2)
179179
.with_width(usize::MAX);
180+
181+
let h = if !colored {
182+
h.without_syntax_highlighting()
183+
} else {
184+
h
185+
};
186+
180187
h.render_report(&mut buf, self.as_ref()).into_diagnostic()?;
181188
Ok(buf)
182189
}

packages/rspack-test-tools/src/processor/diagnostic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class DiagnosticProcessor<
4545

4646
const statsJson = stats.toJson({
4747
all: false,
48+
colors: false,
4849
errors: true,
4950
warnings: true
5051
});

0 commit comments

Comments
 (0)