-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Labels
Milestone
Description
Running stack test also builds all executables. Using fast-tags package as an example :
❯ stack test
fast-tags-1.1.0: configure (test)
Configuring fast-tags-1.1.0...
fast-tags-1.1.0: build (test)
Building fast-tags-1.1.0...
Preprocessing library fast-tags-1.1.0...
In-place registering fast-tags-1.1.0...
Preprocessing executable 'fast-tags' for fast-tags-1.1.0...
Linking .stack-work/dist/x86_64-osx/Cabal-1.18.1.5/build/fast-tags/fast-tags ...
Preprocessing test suite 'test-fast-tags' for fast-tags-1.1.0...
Linking .stack-work/dist/x86_64-osx/Cabal-1.18.1.5/build/test-fast-tags/test-fast-tags ...
fast-tags-1.1.0: test (suite: test-fast-tags)
tests
tokenize
"a::b->c": OK (0.02s)
(...)
I can simulate the desired behavior by defining a testonly flag and marking all executables with if flag(testonly) buildable: False. With executables:
time stack test
stack test 5.79s user 1.60s system 127% cpu 5.777 total
And without:
time stack test --flag fast-tags:test
stack test --flag fast-tags:test 4.73s user 1.45s system 130% cpu 4.724 total
These are incremental, not clean, builds. Skipping executables makes running tests slightly faster. This is particularly useful when there are many executables and only a single test-suite.