Skip to content

Commit f004692

Browse files
authored
Merge pull request #546 from marsonya/doctest-contribution-guidelines
Doctest contribution Guidelines added to Contributing.md
2 parents 1abd3aa + d31b036 commit f004692

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ Algorithms in this repo should not be how-to examples for existing JavaScript pa
4949
- There should be no spaces in filenames.
5050
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not
5151

52+
#### Testing
53+
54+
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.
55+
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.
56+
57+
The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest).
58+
59+
It is advised that you add the Doctests in a multiline comment just after the Algorithm description.
60+
For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js).
61+
62+
You can run the doctest by using the command
63+
```
64+
$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js
65+
```
66+
5267
#### Coding Style
5368

5469
To maximize the readability and correctness of our code, we require that new submissions follow [JavaScript Standard Style](https://standardjs.com/)
@@ -80,9 +95,6 @@ To maximize the readability and correctness of our code, we require that new sub
8095
- Please use 'console.log()'
8196
- We strongly recommend the use of ECMAScript 6
8297
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
83-
84-
85-
8698
- Most importantly,
8799
- **Be consistent in the use of these guidelines when submitting.**
88100
- Happy coding!

0 commit comments

Comments
 (0)