Module: core

The core module provides the basic objects and functions for describing, structuring and running tests with Specify.

Signals

class core.Hook
type Hook
  actions: Array<Future<Error, Void>>

methods
  run: @Hook => Void -> Rx.Observable<Error, α>

Represents a list of actions that are to be ran in reaction to some event.

class core.Signal
type Signal = Started
                value: Test
                path: Array<String>

            | Finished
                value: Test
                path: Array<String>

            | TestResult
                value: Result

methods
  fullTitle: @Signal => Void -> String

Represents one of the important events that might happen when running tests.

Tests

class core.Test
type Test = Suite
              name: String
              tests: Array<Test>
              beforeAll: Hook
              afterAll: Hook
              beforeEach: Hook
              afterEach: Hook

          | Case
              name: String
              test: Future<Error, Void>
              timeout: Maybe<Number/ms>
              slow: Maybe<Number/ms>
              enabled: Maybe<Case -> Boolean>

methods
  run: [String], Config -> Rx.Observable[Error, Signal]

The Test type models the components of a specification hierarchy.

Results

class core.Duration
type Duration
  started: Date
  finished: Date
  slowThreshold: <Number/ms>

methods
  isSlow: @Duration => Void -> Boolean
  time: @Duration => Void -> <Number/ms>
  toString: @Duration => Void -> String

Represents the duration of a particular tests.

class core.LogEntry
type LogEntry
  date: Date
  log: Array<Any>

Represents content that has been logged during the execution of a test.

class core.Result
type Result = Success
                title: Array<String>
                duration: Duration
                log: Array<LogEntry>

            | Failure
                title: Array<String>
                exception: Any
                duration: Duration
                log: Array<LogEntry>

            | Ignored
                title: Array<String>

methods
  fullTitle: @Result => Void -> String
  name: @Result => Void -> String

Represents the result of running a test Case.

Reports

class core.Report
type Report
  started: Date
  finished: Date
  passed: Array<Result>
  failed: Array<Result>
  ignored: Array<Result>

methods
  add: @Report => Result -> Report
  empty: @Report => Void -> Report
  time: @Report => Void -> <Number/ms>
  all: @Report => Void -> Array<Result>

Summarises the execution of a series of test cases.

Running

class core.Config
type Config
  slowThreshold: <Number/ms>
  timeout: <Number/ms>
  runOnly: Case -> Boolean
core.defaultConfig

The default configuration for running tests.

core.makeRunner(config, suites, reporter)
Config
-> Array<Test>
-> (Rx.Observable<α, Signal>, Rx.Observable<α, Report> -> Void)
-> Future<Error, Report>

Constructs a task for running all tests.

core.run(config, suites, reporter)
Config
-> Array<Test>
-> (Rx.Observables<α, Signal>, Rx.Observable<α, Report> -> Void)
-> Void

Runs a series of test cases.

core.runWithDefaults(suites, reporter)
Config
-> Array<Test>
-> (Rx.Observables<α, Signal>, Rx.Observable<α, Report> -> Void)
-> Void

Runs a series of test cases using the defaultConfig.

See also

Function run()
runWithDefaults is just a partially applied run.