{"__v":5,"_id":"56498f62f176080d000c78ac","category":{"__v":12,"_id":"559b65be8b04e90d00702d58","pages":["559b65bf8b04e90d00702d5a","55a46241ffd44e0d00fca056","55a46f45e75ca60d00a39323","55a470b768c7e20d0036d4d6","55a4a758dad9d00d0071fcba","55b6b6276127b12500364560","55baf505d0736b3100bf1033","55c25ef1f2cff20d006d0b8a","56269a8b44c87f0d00fe6378","56498f62f176080d000c78ac","566f59c4fc3abb0d0020fcd5","567cd2228eb5b20d0021059d"],"project":"559b65bd8b04e90d00702d54","version":"559b65bd8b04e90d00702d57","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-07T05:38:06.409Z","from_sync":false,"order":0,"slug":"chimpjs","title":"Chimp.js"},"parentDoc":null,"project":"559b65bd8b04e90d00702d54","user":"559b658d8b04e90d00702d52","version":{"__v":6,"_id":"559b65bd8b04e90d00702d57","project":"559b65bd8b04e90d00702d54","createdAt":"2015-07-07T05:38:05.890Z","releaseDate":"2015-07-07T05:38:05.890Z","categories":["559b65be8b04e90d00702d58","55a46e7468c7e20d0036d4d1","55a4971be6c2470d002a6483","55a4a690e10ba50d00b40bba","55a4bcf31a5f991700a94066","56cf5c8d336aa60b0086a40d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":["56a4310595be510d00cb9c5a"],"next":{"pages":[],"description":""},"createdAt":"2015-11-16T08:10:10.860Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Follow the [Installation](doc:installation) instructions here.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Develop\"\n}\n[/block]\nTo start developing using Mocha, you have to start Chimp with the `--mocha` flag like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"chimp --mocha --watch\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nChimp will watch your feature directory for any `.js` files and rerun any `describe`/`it` blocks  that contain the string `:::at:::watch`. For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"describe('Chimp Mocha', function() {\\n  describe('Page title', function () {\\n    it('should be set by the Meteor method @watch', function () {\\n      browser.url('http://www.google.com');\\n      expect(browser.getTitle()).to.equal('Google');\\n    });\\n  });\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nBy default, Chimp starts a Google Chrome browser window. This is where your specs will run and you can use this window to see the automation as it happens. Chimp also ensures the same window will remain open between your specs rerunning so you won't get an annoying window popup. \n\nThe watch mode is designed to keep you focused on the task at hand. The idea is you work on a scenario through to completion, and then move the `@watch` tag to the next spec you are working on.\n\nYou can see this mode in action in the [demo video](http://chimpjs.com)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Test\"\n}\n[/block]\nYou've now finished your tasks and are ready to commit your code. If you want to run the build locally you can run all the tests using this command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"chimp --mocha --browser=firefox\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nChimp recognizes that you're not in watch mode and will run all the specs.\n\nNotice how you can use a different browser. It's a good practice to develop using one browser and run all tests with another. \n\nThis same command can also be used on CI servers.\n\n---\n\n<a href=\"http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch\"><img src=\"https://files.readme.io/764e495-qualityfasterbook-commas.small.png\" width=\"200\" align=\"right\" /></a>\n##Learn the Fundamentals of Testing, Specifications and Become a Chimp Ninja!\n[Checkout our new book](http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch) where you can learn how to can use Chimp across the Full Stack from React to Node.JS, Mocha, Meteor and more.\n\n\n**[Quality, Faster.](http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch)** By Sam Hatoum, creator of Chimp.","excerpt":"A quick intro","slug":"getting-started-mocha","type":"basic","title":"Getting Started - Mocha"}

Getting Started - Mocha

A quick intro

Follow the [Installation](doc:installation) instructions here. [block:api-header] { "type": "basic", "title": "1. Develop" } [/block] To start developing using Mocha, you have to start Chimp with the `--mocha` flag like this: [block:code] { "codes": [ { "code": "chimp --mocha --watch", "language": "shell" } ] } [/block] Chimp will watch your feature directory for any `.js` files and rerun any `describe`/`it` blocks that contain the string `@watch`. For example: [block:code] { "codes": [ { "code": "describe('Chimp Mocha', function() {\n describe('Page title', function () {\n it('should be set by the Meteor method @watch', function () {\n browser.url('http://www.google.com');\n expect(browser.getTitle()).to.equal('Google');\n });\n });\n});", "language": "javascript" } ] } [/block] By default, Chimp starts a Google Chrome browser window. This is where your specs will run and you can use this window to see the automation as it happens. Chimp also ensures the same window will remain open between your specs rerunning so you won't get an annoying window popup. The watch mode is designed to keep you focused on the task at hand. The idea is you work on a scenario through to completion, and then move the `@watch` tag to the next spec you are working on. You can see this mode in action in the [demo video](http://chimpjs.com) [block:api-header] { "type": "basic", "title": "2. Test" } [/block] You've now finished your tasks and are ready to commit your code. If you want to run the build locally you can run all the tests using this command: [block:code] { "codes": [ { "code": "chimp --mocha --browser=firefox", "language": "shell" } ] } [/block] Chimp recognizes that you're not in watch mode and will run all the specs. Notice how you can use a different browser. It's a good practice to develop using one browser and run all tests with another. This same command can also be used on CI servers. --- <a href="http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch"><img src="https://files.readme.io/764e495-qualityfasterbook-commas.small.png" width="200" align="right" /></a> ##Learn the Fundamentals of Testing, Specifications and Become a Chimp Ninja! [Checkout our new book](http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch) where you can learn how to can use Chimp across the Full Stack from React to Node.JS, Mocha, Meteor and more. **[Quality, Faster.](http://quality.xolv.io/?utm_source=XolvOSS&utm_medium=OSSDocs&utm_content=ChimpRM-Footer&utm_campaign=QFLaunch)** By Sam Hatoum, creator of Chimp.