My first Pull Request

During the past years, I have used github to store my labs and assignments. I knew that its main purpose is to help collaboration between programmers. I also knew how to clone, pull, commit and push codes. I even knew what is a pull request. But, I never try once, to participate in the community. The reason was pretty clear, I was so afraid as a fresh new, request to fix the projects of other experienced programmers seems to be scary for me.

Then right now I'm taking the course DPS909 - Open Source Development, making my first issue posting and fixing request. Although it is not a big one, but still I can image how easy and friendly the process is, to take part in the developer community.

The Project and Issue

The project I'm working on in the course is filer.js, which is a "a POSIX-like file system interface for node.js and browser-based JavaScript". It follows the node.js interface and therefore, when node.js releases a new feature, filer.js may take a while to catch up.

Currently node.js provided fs() promise api, a feature which filer.js has just supported too. However it did not have any test for the new api, therefore I submitted an issue and asked to be assigned to work on.

The Pull Request

The fixing was not quite hard since all I needed is just to follow the current callback code, but using promise method. Let take a look at the asynchronous code, the callback checks for error to exist, error.code to be equal to 'ENOENT' and result not to exist, then calls done() to finish the test.

The added synchronous test gets the api fs.promise(), then calls to the functions above in proper order.


Now the pull request is where I was having a bit troubles. I did not know that there would be a check phase to the pushed code, even so I did not realize that my code had a very basic styling mistake - missing semi colon. After all everything went well, and I learned how to make a pull request.


The Feedback

I made a comment to my own pull request, which is a reply to a very nice feedback from my classmate. At first she suggested not to use done(), and return a promise instead or it would be an error. I was a bit surprised because I did test the code and it worked pretty well. Then I came to the the Mocha website (which is the library filer.js uses for testing), and noticed that what my classmate said was actually another way to use the test (mine is synchronous method and her is asynchronous one).

Then I surfed through the other similar pull requests and found the answer. The pull request was fixed as suggestion of professor of the course, and it followed the synchronous method, so I guessed it should be the right way to test promise functions.

Finally I made the change as my classmate feedback, with a reply to clear things up. After all, that was a nice journey with lots of experiences.

Comments

Popular Posts