@jsspec/format

0.1.7 • Public • Published

@jsspec/format

npm (scoped) Travis AppVeyor

Default reporter formatters for jsspec.

class MyFormatter {
  static get description() { return 'I write stuff to the screen'; }
  constructor(specRunner){}
}

subscribe to specRunner events:

  specRunner.on('fileStart' (uniqueFileRunReference, fileName) => {});
  specRunner.on('fileEnd' (uniqueFileRunReference, fileName) => {});
  specRunner.on('contextStart' (specRunner, context) => {});
  specRunner.on('contextEnd' (specRunner, context) => {});
  specRunner.on('exampleStart' (specRunner, example) => {});
  specRunner.on('exampleEnd' (specRunner, example) => {});
  specRunner.on('contextLevelFailure', (specRunner, exampleOrContext) => {});
  specRunner.on('runEnd' (specRunner) => {});

context, example and exampleOrContext each respond to the following:

id // [For a conetxt only] a unique name for this context
description // the description supplied
fullDescription // the description, with all context descriptions pre-pended
kind // the class name of the object
base // a uniq name relating to this spec file run
failure // which may be (hopefully) undefined

failure is either an exception, or an exception converted to an object, depending on how JSSpec was run. It will have the following attributes:

constructor.name
stack
message
expected // may be empty
actual // may be empty

Formatters included:

Null

Does nothing. Use with --format null. Can be used as a base class to create other formatters.

Documentation

-fd or --format documentation. Presents a tree of execution results with checks and crosses for example results. A summary of failures are provided at the end.

Dot

-fo or --format dot. Single character output per test. With summary at the end.

Readme

Keywords

Package Sidebar

Install

npm i @jsspec/format

Weekly Downloads

0

Version

0.1.7

License

MIT

Unpacked Size

17.5 kB

Total Files

12

Last publish

Collaborators

  • hookyqr