Skip to content

Commit

Permalink
Fixed failing test for Ansi.enabled()
Browse files Browse the repository at this point in the history
Fixed unit test by resetting the cached isJansiConsoleInstalled result.
  • Loading branch information
ChrisTrenkamp committed Mar 20, 2023
1 parent 89e0382 commit 2400268
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/java/picocli/HelpAnsiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ public void testAnsiEnabled() {

if (isWindows && !Ansi.AUTO.enabled()) {
AnsiConsole.systemInstall();

// The previous Ansi.enabled() call caches the result for whether or not jansi is enabled. Reset the cache value
// and force the Ansi.enabled() call to rescan the classpath for the jansi classes.
Ansi.jansiConsole = null;
try {
assertTrue(Ansi.AUTO.enabled());
} finally {
Expand Down

0 comments on commit 2400268

Please sign in to comment.