Introduction:
From Release-0.1, I learned how to find and fix bug on open source projects. It is mainly divided in to the following steps.
- find a bug in upstream code
- issue that bug (github will generate a issue number for you)
- fork the upstream code to your own repository
- clone the forked code($git clone “url”)
- set upstream and origin ($git remote add upstream & $git remote add upstream )
- fix that bug locally
- test the code after you fix that bug (npm test)
- pull request
- create and switch a new branch for that issue ($git checkout -b issue-123)
- add the file you changed to git ($git add + all_changed_file)
- commit your change ($git commit -m “commit words”)
- push your change to origin
- open pull request (ask upstream to accept your change
- review
All these steps are important when we want to declare a issue and pull our requests.
Issue I found:
The issue I found this time is from a open source project called filerjs. It is a POSIX-like file system interface for node.js and browser-based JavaScript. For this open source project a add a test for fs.writeFile-readFile.spec to write a file in non-existing path.
The link to my issue is: https://github.com/filerjs/filer/issues/450
Pull Request:
This is the link of my pull request: https://github.com/filerjs/filer/pull/486
it('should error when path is wrong to writeFile',function(done){ var fs = util.fs(); fs.writeFile('/tmp/myfile', '','utf8', function(error, result) { expect(error).to.exist; expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); });
The test I added to fs.writeFile-readFile.spec will call error when we are trying to write a file in a non-existing path. This code is successfully passed the npm test.
Review:
I also reviewed other contributors’ code about fixing bugs for filerjs.
For example, from one contributor’s pull requestt, I found that he/she is missing one expect if he/she want to test the non-existing of path or file. First of all I praised his contribution to this open source project, then I told him my opinion and what he can add to his code to improve. Hope my suggestion works.
Currently I did not get any comments of my pull request yet. But if any other contributors give me any advises or point out my mistake, I will politely reply their comments, carefully think about their ideas and modify my code if necessary.
Community Involvement
Github provides us a great platform for open source development. Developers can involves, contributes and review each other’s code there. Release-0.1 gives me a chance to understand more about how open source projects works. Reviewing other people’s code gives me a lot of inspirations about how to write a solid code. I also get some practice to use git and github.