Socket
Socket
Sign inDemoInstall

docunit

Package Overview
Dependencies
117
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    docunit

Makes sure the code examples in your docs actually work


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

docunit

Build Status

There's nothing worse than a documented use of a library that doesn't actually work the way the docs say it does. But because docs tend to be written at discrete moments of a project's life, they're only validated at those particular moments—inevitably, the behavior of the API will diverge and someone will need to carry the burden of remembering to updathe docs.

Well, not anymore! docunit is a tool that checks the code blocks in your Markdown files to ensure they actually do what they say they do.

Install

$ npm install --save-dev docunit

API

var docunit = require('docunit')

docunit('test/fixtures/1-hello-world.md', function(er, results){
  results.passed // true
  results.assertions.length // 1
  results.files // ['test/fixtures/1-hello-world.md']

  var assertion = results.assertions[0]
  assertion.lineNumber // 8
  assertion.actual // "greeting + ', world'"
  assertion.expected // "'hello, world'"
  assertion.result.passed // true
  assertion.result.actual // 'hello, world'
  assertion.result.expected // 'hello, world'
})

CLI

Warning: does not exist

$ docunit "path/to/docs/**/*.md"

Keywords

FAQs

Last updated on 20 Dec 2015

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