Socket
Socket
Sign inDemoInstall

bitwane-test

Package Overview
Dependencies
10
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bitwane-test

The test formatting version of bitwane


Version published
Weekly downloads
6
Maintainers
1
Install size
1.54 MB
Created
Weekly downloads
 

Readme

Source

bitwane-test

A test output version of bitwane.

Install

npm install bitwane-test

Usage

import { TestLogger } from '../';
const logger = new TestLogger();

//Print a diff of an object
logger.diff({
    one: 1,
    two: 2,
    thing: 'thing1',
    sub: {
        subone: 1,
        subtwo: 2
    }
}, {
    one: 1,
    three: 'three',
    thing: 'thing2',
    sub: {
        subone: 1
    }
});

//Print a diff a string.
logger.diff(`I am thing one`, `I am thing two`)
//Print a diff a string, and indent it.
logger.diff(`I am a thing one`, `I am thing two`, 4)

//Print an ok (log) line, and indent it 8 spaces.
logger.ok('This is ok', null, 8);
//Print a notok (error) line.
logger.notok('This is not ok');
//Print an formatted ok line with a red colored word.
logger.ok('The $(red)%(what)$() is red.', {what: 'moon'});

The constructor

The constructor takes the same options as bitwane with an extra option named maps.

const logger = new TestLogger({
    //These are all default values
    maps: {
        ok(value){
            return logSymbols.success + ' ' + value;
        },
        notok(value){
            return logSymbols.error + ' ' + value;
        },
        diff(lvalue, rvalue, indent){
            //Return a diff string
            //An inline diff is the default
        }
    }
});

About

bitwane-test inherits from bitwane. It is meant for formatting test output.

Keywords

FAQs

Last updated on 10 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc