NegativeKarma / fizz_buzz_js_karma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS Test Boilerplate 0.1 (WIP)

Build Status Coverage Status

####Dependencies

####Services

####Set up Fork or download this repo (using git clone) and modify the files to suite your testing needs.

You can also use SVN to download this repo to your new project folder. On OSX you can install SVN using Homebrew.

$ brew install subversion

Create a new folder and cd into it. Run the svn export command to download files.

$ svn export https://github.com/CraftAcademy/karma-jquery-jasmine_boilerplate/trunk . --force

Once downloaded, you need to install all dependencies. Run

$ npm install

####Usage You can use this setup to test your units and your jQuery events. Place your JavaScript code in assets/js/ folder and partials in spec/fixtures/ folder.

Your specs need to be end with _spec.js (e.g. fizz_buzz_spec.js)

Run tests with

$ npm test

# or

$ karma start karma.conf.js

####Adding tests I have included some basic specs and js code for you to examine. Basically you need to build up your test environment and tear it down afterwards. You can have different setups by nesting your describe blocks/functions.

# spec/my_spec.js
describe("Given my code", function () {

	beforeEach(function () {
		/* ... Set up your test ... */
	});

	afterEach(function () {
		/* ... Tear it down ... */
	});

	describe("When ...", function () {

		beforeEach(function () {
		  /* ... Context specific setup ... */
		});

		it("Then...", function () {
			expect(true).toEqual(true);
		});
	});
});

About


Languages

Language:JavaScript 100.0%