Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

ghc: could not execute: hspec-discover when running haskell workflow #254

Open
minimapletinytools opened this issue May 22, 2023 · 2 comments
Labels
question Further information is requested

Comments

@minimapletinytools
Copy link

Hitting build failures with ghc: could not execute: hspec-discover which is the hspec preprocessor that discovers all the test files in the project.

See https://github.com/pdlla/tinytools/actions/runs/5051277877/jobs/9062940842

Unclear to me if this is in the domain of haskell/actions but hspec seems common enough that I thought it would be worth reporting here.

@sol
Copy link
Member

sol commented May 23, 2023

Make sure to add

tests:
  tinytools-test:
    build-tools: hspec-discover

to your package.yaml.

(or build-tool-depends: hspec-discover:hspec-discover if you are using plain .cabal)

This is needed if you want to build your project with cabal. For stack it's not required.

@sol
Copy link
Member

sol commented May 23, 2023

Also note that cabal test all may skip tests. You have to use cabal test all --enable-tests (sounds comical, but sadly it's true haskell/cabal#5079).

Alternatively, run cabal configure --enable-tests --enable-benchmarks first.

This is what you probably want to use:
https://github.com/sol/run-haskell-tests/blob/main/action.yml#L15-L24

@andreasabel andreasabel added the question Further information is requested label May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants