Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests needed #9

Open
reggi opened this issue Aug 27, 2015 · 2 comments
Open

Tests needed #9

reggi opened this issue Aug 27, 2015 · 2 comments

Comments

@reggi
Copy link
Owner

reggi commented Aug 27, 2015

This library needs some form of unit testing. There are over 150 individual functions that make up evalmd, a lot of logging and writing to stdout & stderr, flags, exit codes, relying on package.json, deps that need to be installed. There are two ways of testing evalmd.

  1. I can collect full module / repos. Assert an exit code and evaluate the markdown. Something like testSuccess('https://github.com/ljharb/object.assign', 'README.md') (probably wise to specify commit hash) where this would git clone the repo and run npm install then evaluate the markdown. Ideally I can supply optional flags as well. This method can use nixt to ensure the bin itself works as expected, and the exit code is correct.
  2. I can test each and every function individually which would be great because them I can ensure code coverage. Or because eval-markdown.js returns one function that utilizes every other function I can just test it, however I still run into an issue where I need — not only a single markdown file to test, but a whole environment with package.json and node_modules.
  3. A combination of both methods. (probably wise, however a ton of work)

Thoughts?

@reggi
Copy link
Owner Author

reggi commented Aug 27, 2015

@ljharb I'd love your opinion on this. What do you think the best way to test this library is?

@ljharb
Copy link
Collaborator

ljharb commented Aug 27, 2015

You can test the vast majority by just providing a folder full of example markdown files.

You can then make subdirectories with package.json files and a markdown file to test each of the edge cases of requiring the current package in the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants