Coder Social home page Coder Social logo

mithun / mocha-pretty-bunyan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nihonjinrxs/mocha-pretty-bunyan

0.0 0.0 0.0 70 KB

mocha-pretty-bunyan: an NPM package providing pretty bunyan log rendering for mocha tests

License: Other

JavaScript 50.68% Shell 49.32%

mocha-pretty-bunyan's Introduction

@mayachit/mocha-pretty-bunyan

Description

bunyan is a pretty nice package to log in JSON format, and provides an awesome cli to display it in human readable way. However, when you run your test with mocha, you cannot take benefit of the cli, so you then get raw JSON logs that is a mess to read.

@mayachit/mocha-pretty-bunyan displays the bunyan log stream using a pretty/human readable format in the context of a mocha reporter. @mayachit/mocha-pretty-bunyan does not actually implement a mocha reporter, rather just wraps the stdout stream of a mocha reporter (spec, by default) using @ambassify/bunyan-prettystream.

Install

npm install @mayachit/mocha-pretty-bunyan --save-dev

Note that @mayachit/mocha-pretty-bunyan itself does not depend on a version of mocha or bunyan, but declares them as a peerDependency assuming that you already have both mocha and bunyan installed.

Usage

mocha --reporter @mayachit/mocha-pretty-bunyan

Configuration

@mayachit/mocha-pretty-bunyan will attempt to load a JSON configuration file from test/mocha-pretty-bunyan.json. A custom configuration file can also be specified using the MOCHA_PRETTY_BUNYAN_CONFIG environment variable.

The following configurations are supported:

Key Default Value Description
mute false Set to true if you want to mute all logs
level trace Valid bunyan log-level
reporter spec Mocha reporter to use

Example configuration file:

{
  "mute": false,
  "level": "debug",
  "reporter": "spec"
}

Since @mayachit/mocha-pretty-bunyan essentially require's the mocha reporter specified, any --reporter-options will be passed through to the reporter specified in the configuration above.

For example, if you want to use mocha-multi-reporters, specify mocha-multi-reporters as the reporter in test/mocha-pretty-bunyan.json and then run:

mocha --reporter @mayachit/mocha-pretty-bunyan --reporter-options configFile=test/mocha-multi-reporters.json

Credits


mocha-pretty-bunyan's People

Contributors

blurab avatar mithun avatar noerrra 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.