Coder Social home page Coder Social logo

docunit's People

Contributors

searls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docunit's Issues

Support easy configurability

like any test tool, a lot of configuration will be necessary to be usable. my idea here is to have a global config passed to docunit(globs, [config]) with some properties like:

  • before(cb) and after(cb) - invokes cb with ('example|file|all', text|path|??), respectively, each invoked outside the vm/context the tests are run
  • setup/teardown(cb) - invokes cb for each file|example|all invoked inside the vm/context the tests are run
  • freshVmPer: example|file|all - start a fresh VM for each example, file, or all
  • language - JS|Coffee|Babel|Ruby, etc, which will require a registered plugin from docunit to be able to compile

If any config options are static and differ between files, some CSON front matter could be used on a file-by-file basis, a la:

language: 'ruby'

Hello world

Read in a single markdown file, find the code example, run it:

  • test for a passing code example
  • test for a failing code example

add a CLI

a CLI command called docunit that takes as arguments paths/globs

support compile-to-JS langs

an adapter API to register (on a per-process basis, via docunit.register()) adapter functions for things like coffee-script & babel to be able to run those languages.

The config for which lang we're looking at will be with three levels of locality:

  • global config, whatever is passed to docunit('paths', config) as language
  • file config, whatever's in the CSON frontmatter of the markdown file language key
  • example block, whatever name follows the "", like " coffee", allowing users to mix and match within a file

register should receive an object with properties:

  • assertionFor -- function passed a string line, the provided function should split on any inline comments found and return falsey (no assertion needed) or an object containing expected and actual strings. docunit will replace the line with lines to save off the values and include an asserty
  • compile - function to compile any given block of code, probably just delegating to coffee/babel, etc; the compiled output needs to preserve code comments, which means CoffeeScript is out, but babel has an option

config block to squelch errors

right now throwing an error in a code block will break the test as well

throw new Error("LOL")

A config option should probably be available to squash these as some docs obviously want to throw errors

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.