Coder Social home page Coder Social logo

hspec-slow's Introduction

hspec-slow

Track and display slow specs in Hspec runs.

Example spec

main :: IO ()
main = do
  conf <- configure 1 -- Track specs that take longer than 1s
  timedHspec conf $ \it ->
    describe "Main" $ do
      it "should foo" $ do
        threadDelay 3000000
        1 `shouldBe` 1
      it "should bar" $ do
        threadDelay 1000
        1 `shouldBe` 1
      it "should baz" $ do
        threadDelay 4000000
        1 `shouldBe` 1

Checkout hspec slow everything to run this on your entire test suite.

Example Output

Main
  should foo
  should bar
  should baz
Slow examples:
3.002925s: should foo
4.006186s: should baz

Finished in 7.0141 seconds
3 examples, 0 failures

Parallel specs

Parallel specs are supported. They are run similarly to above:

timedHspecParallel conf $ \it -> do
  -- ...

Output:

Main
  should foo
  should bar
  should baz
Slow examples:
3.005728s: should foo
4.00143s: should baz

Finished in 4.0024 seconds
3 examples, 0 failures

hspec slow everything

Main.hs:

module Main where

import qualified Spec
import Test.Hspec.Slow
import Test.Hspec(hspec)
import ClassyPrelude

main :: IO ()
main = do
  config <- configure 2
  hspec $ timeThese config Spec.spec

Spec.hs:

{-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}

hspec-slow's People

Contributors

bobjflong avatar jappeace avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.