Skip to content

Commit baf08a5

Browse files
authored
Merge pull request #8942 from haskell/test-details-direct
Make --test-show-details=direct the default
2 parents 10de4e5 + 47c70d6 commit baf08a5

File tree

5 files changed

+43
-8
lines changed

5 files changed

+43
-8
lines changed

Cabal/src/Distribution/Simple/Setup/Test.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ defaultTestFlags = TestFlags {
9292
testVerbosity = Flag normal,
9393
testHumanLog = toFlag $ toPathTemplate $ "$pkgid-$test-suite.log",
9494
testMachineLog = toFlag $ toPathTemplate $ "$pkgid.log",
95-
testShowDetails = toFlag Failures,
95+
testShowDetails = toFlag Direct,
9696
testKeepTix = toFlag False,
9797
testWrapper = NoFlag,
9898
testFailWhenNoTestSuites = toFlag False,

changelog.d/issue-7817

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
synopsis: Make --(test-)show-details=direct the default
2+
packages: Cabal cabal-install
3+
prs: #8942
4+
5+
description: {
6+
7+
This option leaves it up to the testing framework to decide what and how to print out,
8+
potentially leading to a prettier output. For example, most of the testing frameworks
9+
use colors, which wouldn't be seen with any other option.
10+
11+
This comes with a tradeoff, though: Cabal will not create a log file with this option.
12+
If you prefer a log file, consider setting `--test-show-details=streaming` (or something
13+
else) manually.
14+
15+
}

doc/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ http://cabal.readthedocs.io/
1111

1212
### How to build it
1313

14-
Building the documentation requires Python 3 be installed
15-
* `> make users-guide`
16-
* Python on Mac OS X dislikes `LC_CTYPE=UTF-8`, unset the env var in
17-
terminal preferences and instead set `LC_ALL=en_US.UTF-8` or something
14+
Building the documentation requires Python 3 and PIP. From the root of cabal
15+
repository run:
16+
17+
``` console
18+
make users-guide
19+
```
20+
21+
Note: Python on Mac OS X dislikes `LC_CTYPE=UTF-8`, so unset the variable
22+
and instead set `LC_ALL=en_US.UTF-8`.
1823

1924
### Gitpod workflow
2025

doc/cabal-commands.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ legacy sections. We talk in detail about some global and package commands.
2626

2727
run Run an executable.
2828
repl Open an interactive session for the given component.
29-
test Run test-suites.
29+
test Run test suites.
3030
bench Run benchmarks.
3131

3232
sdist Generate a source distribution file (.tar.gz).
@@ -970,13 +970,22 @@ cabal bench
970970
(all the benchmarks in the current package by default), first ensuring
971971
they are up to date.
972972

973+
``cabal bench`` inherits flags of the ``bench`` subcommand of ``Setup.hs``,
974+
:ref:`see the corresponding section <setup-bench>`.
975+
973976
cabal test
974977
^^^^^^^^^^
975978

976979
``cabal test [TARGETS] [OPTIONS]`` runs the specified test suites
977980
(all the test suites in the current package by default), first ensuring
978981
they are up to date.
979982

983+
``cabal test`` inherits flags of the ``test`` subcommand of ``Setup.hs``
984+
(:ref:`see the corresponding section <setup-test>`) with one caveat: every
985+
``Setup.hs test`` flag receives the ``test-`` prefix if it already does
986+
not have one; e.g. ``--show-details`` becomes ``--test-show-details`` but
987+
``--test-wrapper`` remains the same.
988+
980989
cabal exec
981990
^^^^^^^^^^
982991

doc/setup-commands.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,14 @@ the package.
12921292

12931293
Determines if the results of individual test cases are shown on the
12941294
terminal. May be ``always`` (always show), ``never`` (never show),
1295-
``failures`` (show only failed results), or ``streaming`` (show all
1296-
results in real time).
1295+
``failures`` (show only failed results), ``streaming`` (show all
1296+
results in real time) and ``direct`` (same as ``streaming`` but no log
1297+
file and possibly prettier).
1298+
1299+
Default value is ``direct``: it leaves test output untouched and does not
1300+
produce a log. This allows for colored output, which is popular with testing
1301+
frameworks. (On the other hand, ``streaming`` creates a log but looses
1302+
coloring.)
12971303

12981304
.. option:: --test-options=options
12991305

0 commit comments

Comments
 (0)