1.0.0 • Published 5 years ago

mocha-markdown v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Mocha Markdown

Mocha-Markdown is a tiny utility designed to help reduce the boilerplate involved with writing tests. It lets you transform blocks of Markdown which look like this:

# Requirements
- List the requirements for your application here.
- Each requirement will be transformed into a test for you.
  - If you want to describe more specific properties of a requirement, simply indent the list.
  - Arbitrary levels of indentation should work.
    - Write as much as you like!
- In the end, mocha-markdown will take this list and spit out JavaScript within a file for you.
- By default, the file will be called test.js inside the directory in which you run this tool.

# Application
This text does not matter. mocha-markdown will ignore it.

Into JavaScript code which looks like this:

describe("List the requirements for your application here.", () => {});
describe("Each requirement will be transformed into a test for you.", () => {
  describe("If you want to describe more specific properties of a requirement, simply indent the list.", () => {});
  describe("Arbitrary levels of indentation should work.", () => {
    describe("Write as much as you like!", () => {});
  });
});
describe("In the end, mocha-markdown will take this list and spit out JavaScript within a file for you.", () => {});
describe("By default, the file will be called test.js inside the directory in which you run this tool.", () => {});

That's it! Interesting CLI options are as follows:

  • --inputfile or -i lets you specify which Markdown file you want mocha-markdown to look at. This argument is required.
  • --headers lets you select arbitrary headers within your describe block that contain lists of requirements which you want mocha-markdown to parse.
  • --outputpath or -o lets you specify where you want the file mocha-markdown generates to be.

TODO

  • Finish adding basic functionality.
  • Hook prettier into the code generation.
  • Configure command line interface with yargs.
  • Add more documentation.
  • Publish project on NPM.
  • Write a plugin for VSCode.