Skip to content

Doctest contribution Guidelines added to Contributing.md #546

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ Algorithms in this repo should not be how-to examples for existing JavaScript pa
- There should be no spaces in filenames.
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not

#### Testing

Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes.
We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result.

The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest).

It is advised that you add the Doctests in a multiline comment just after the Algorithm description.
For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js).

You can run the doctest by using the command
```
$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js
```

#### Coding Style

To maximize the readability and correctness of our code, we require that new submissions follow [JavaScript Standard Style](https://standardjs.com/)
Expand Down Expand Up @@ -80,9 +95,6 @@ To maximize the readability and correctness of our code, we require that new sub
- Please use 'console.log()'
- We strongly recommend the use of ECMAScript 6
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.



- Most importantly,
- **Be consistent in the use of these guidelines when submitting.**
- Happy coding!
Expand Down