mocha-markdown
v1.0.0
Published
Transform Markdown lists into JavaScript tests.
Readme
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:
--inputfileor-ilets you specify which Markdown file you wantmocha-markdownto look at. This argument is required.--headerslets you select arbitrary headers within your describe block that contain lists of requirements which you want mocha-markdown to parse.--outputpathor-olets you specify where you want the filemocha-markdowngenerates to be.
TODO
- [X] Finish adding basic functionality.
- [X] Hook prettier into the code generation.
- [X] Configure command line interface with yargs.
- [X] Add more documentation.
- [ ] Publish project on NPM.
- [ ] Write a plugin for VSCode.
