Module

Test.Unit

#Test

type Test = Aff Unit

#TestF

#Group

data Group

Constructors

#TestSuite

#TestList

type TestList = List (Tuple (List String) (Test))

A list of collected tests, represented as a tuple of each test's path and the Test itself. The path, in this case, means the name of the test preceded by the name of each parent test suite, in top down order.

#Skip

newtype Skip

Constructors

Instances

#Only

newtype Only

Constructors

Instances

#success

success :: Test

The basic value for a succeeding test.

#failure

failure :: String -> Test

Make a failing test, given a reason for the failure.

#timeout

timeout :: Int -> Test -> Test

Set a test to fail after a given number of milliseconds.

#test

test :: String -> Test -> TestSuite

Define a labelled test.

#testOnly

testOnly :: String -> Test -> TestSuite

Run only this test.

#testSkip

testSkip :: String -> Test -> TestSuite

Skip a test.

#suite

suite :: String -> TestSuite -> TestSuite

Define a test suite, which can contain a number of nested suites as well as tests.

#suiteOnly

suiteOnly :: String -> TestSuite -> TestSuite

Run only this suite.

#suiteSkip

suiteSkip :: String -> TestSuite -> TestSuite

Skip this suite.

#walkSuite

walkSuite :: (List String -> Either String (Tuple String Test) -> Aff Unit) -> TestSuite -> Aff TestList

Walk through a test suite, calling the provided function for each item, and returning a TestList of all tests walked. The tests won't actually run unless you run them explicitly from your walker function.

#filterTests

filterTests :: (Free TestF) ~> (Free TestF)

Filter suites and tests with Only and Skip flags and removes suites that do not contain any tests.

#collectTests

collectTests :: TestSuite -> Aff TestList

Walk through a test suite, returning a TestList of all tests walked. This operation will not actually run the tests.

#collectResults

collectResults :: TestList -> Aff (List (Tuple (List String) (Either Error Unit)))

Run a list of tests and collect each test result.

#countSkippedTests

countSkippedTests :: forall a. Free TestF a -> Int

#keepErrors

keepErrors :: List (Tuple (List String) (Either Error Unit)) -> List (Tuple (List String) Error)

Filter successes out of a list of test results.

#describe

describe :: String -> TestSuite -> TestSuite

describe is an alias for suite for BDD enthusiasts.

#it

it :: String -> Test -> TestSuite

it is an alias for test for BDD enthusiasts.

Modules