How to Write a Library for Node.js and Browser with Mocha Unit Tests
Mocha is a test framework for JavaScript, it provides Node.js and browser versions. Assume we implement a JavaScript library and we want to run unit tests automatically. And also, we want that it could be used in Node.js and browsers. We can use following methods to do that. This example files structure look like this: 12345src\md5.jstests\test.jstests\node-test.jstests\index.htmlpackage.json Or refer to js-md5. InstallationInstall mocha package to your project. 12npm install mocha --save-devnpm ...
Node.js - How to Integrate Travis CI with GitHub
Travis CI is service for Continuous Integration and it is easy to integrate with the projects on GitHub. It support many programming languages. Travis CI will run unit tests after the project update and report the results. This article will introduce how to integrate node.js projects. Enable Travis CI for GitHub projectYou can sign in with GItHub account and find your projects on GitHub. Go to the Accounts page on the top-right side.Click the toggle to enable. .travis.ymlAdd .travis.yml file to ...
How to omit bundle exec prefix by bundle binstubs
bundle binstubsIn Ruby, we use Bundler to manage the gem in our projects. We also use bundle exec prefix to run the command in our projects for ensuring that it’s running in current bundler. Eg. 1bundle exec rake db:migrate But, it seems a little inconvenient so that we can use binstubs to omit it. Assume that we want to generate binstubs of rake: 1bundle binstubs rake This will generate rake script in the bin folder, and now we can run 1./bin/rake equal to 1bundle exec rake If you want to gener ...




