Home > Software engineering >  How can I run Haskell tests by matching a certain file a la Jest?
How can I run Haskell tests by matching a certain file a la Jest?

Time:10-23

I'd like to reorganize my tests in a Haskell package such that each filename.hs has an adjacent filename.test.hs that is run on stack test.

Is there a way to Regex match in package.yaml that would accomplish this? What other considerations do I need to take?

CodePudding user response:

If you want to do automatic test file discovery, you may wish to consider test frameworks for Haskell that provide this feature. Two of the most popular Haskell test frameworks, hspec and tasty, can do automatic file discovery. You can find hspec, tasty, and other Haskell test frameworks on Hackage. If you still want to roll your own custom file discovery code, the source code of the file discovery algorithms in these test frameworks would give you a good place to start.

  • Related