2.0.2 • Published 11 months ago

@japa/synthetic-events v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@japa/synthetic-events

Dummy events to build a Japa tests reporter

github-actions-image npm-image license-image typescript-image

Synthetic events emits a variety of dummy events you can use to build a test reporter for Japa.

Installation

Install the package from npm registry as follows.

npm i -D @japa/synthetic-events

# yarn
yarn add -D @japa/synthetic-events

Usage

In the following example, the yourReporter refers to the implementation of the reporter. Feel free to change the implementation.

import { Emitter, Runner } from '@japa/core'
import { fire } from '@japa/synthetic-events'

const emitter = new Emitter()
const runner = new Runner(emitter)

yourReporter()(runner, emitter)
runner['boot']()

fire(emitter)
import type { Emitter, Runner } from '@japa/core'

export function yourReporter() {
  return function (runner: Runner, emitter: Emitter) {
    emitter.on('suite:start', (suite) => console.log(suite.name))
    emitter.on('group:start', (group) => console.log(`  ${group.title}`))
    emitter.on('test:end', (test) => {
      console.log(`    > ${test.title} (${test.duration})`)
    })
  }
}
3.0.0-0

11 months ago

2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.9

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago