dim-console
A console object that outputs its contents dimmed. For testing.
Last updated 4 years ago by kevingoslar .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dim-console 
SYNC missed versions from official npm registry.

Node.JS Dim Console

A console object for testing console output of libraries

Circle CI dependencies Status devDependencies Status

  • Does not interfere with the built-in console: You inject this library as a dependency into your code. This is cleaner, and simpler in larger code bases or test setups. It ensures that you only capture the output of your library under test. The output of other parts of the system - like your test framework, debuggers, tracers, or other libraries - is not affected.

  • Captures the output to the console: You can verify it against expected output.

  • Dumps the ongoing output as it is captured: Prints it dimmed, so that it is distinguishable from other output.

Usage

const dimConsole = require('dim-console')

// use the dim console in your test code somewhere
// your code must understand and use the respective parameters
myMethodUnderTest({console: dimConsole.console})
myMethodUnderTest({process: dimConsole.process})
myMethodUnderTest({stdout: dimConsole.process.stdout})
myMethodUnderTest({stderr: dimConsole.process.stderr})

// get the stdout output captured so far
dimConsole.stdoutOutput

// get the stderr output captured so far
dimConsole.stderrOutput

// get the cumulated output (stdout + stderr) captured so far
dimConsole.output

// reset the captured output
dimConsole.reset()

Related projects

Update dependencies

$ update

Release a new version

$ publish <patch|minor|major>

Current Tags

  • 0.4.4                                ...           latest (4 years ago)

8 Versions

  • 0.4.4                                ...           4 years ago
  • 0.4.3                                ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |