diff options
-rw-r--r-- | test/README.md | 2 | ||||
-rw-r--r-- | test/busted/outputHandlers/nvim.lua | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/test/README.md b/test/README.md index 65a5ae7912..42d0ec0323 100644 --- a/test/README.md +++ b/test/README.md @@ -285,7 +285,7 @@ Number; !must be defined to function properly): - `VALGRIND_LOG` (F) (S): overrides valgrind log file name used for `VALGRIND`. -- `TEST_COLORS` (F) (U) (D): enable pretty colors in test runner. +- `TEST_COLORS` (F) (U) (D): enable pretty colors in test runner. Set to true by default. - `TEST_SKIP_FRAGILE` (F) (D): makes test suite skip some fragile tests. diff --git a/test/busted/outputHandlers/nvim.lua b/test/busted/outputHandlers/nvim.lua index e17536e0f8..4bfa21fe49 100644 --- a/test/busted/outputHandlers/nvim.lua +++ b/test/busted/outputHandlers/nvim.lua @@ -1,9 +1,15 @@ local pretty = require 'pl.pretty' local global_helpers = require('test.helpers') --- Colors are disabled by default. #15610 local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end}) + +local enable_colors = true if os.getenv "TEST_COLORS" then + local test_colors = os.getenv("TEST_COLORS"):lower() + local disable_colors = test_colors == 'false' or test_colors == '0' or test_colors == 'no' or test_colors == 'off' + enable_colors = not disable_colors +end +if enable_colors then colors = require 'term.colors' end |