Git Product home page Git Product logo

karma's Introduction

Introduction

Karma has two parts, server and client (or clients). Server is the main part, it:

  • watches your files
  • communicates with clients and manages them (through SOCKET connection)
  • serves the code and tests to clients (through HTTP)
  • reposts test results to you  Client runs tests against the code and reports the results to server.

yarn add karma

yarn add karma-cli

yarn add karma-jasmine jasmine-core karma-chrome-launcher

karma init js/.js test/_spec.js

test/fizzbuzz_spec.js

describe("fizzbuzz", function() { describe("#process", function() { it("returns Fizz if number is divisible by 3", function() { expect(fizzbuzz.process(3)).toBe("Fizz"); expect(fizzbuzz.process(6)).toBe("Fizz"); });

it("returns Buzz if number is divisible by 5", function() {
  expect(fizzbuzz.process(5)).toBe("Buzz");
  expect(fizzbuzz.process(10)).toBe("Buzz");
});

it("returns FizzBuzz if number is divisible by both 3 and 5", function() {
  expect(fizzbuzz.process(15)).toBe("FizzBuzz");
  expect(fizzbuzz.process(30)).toBe("FizzBuzz");
});

it("returns number itself if number is not divisible by 3 or 5", function() {
  expect(fizzbuzz.process(4)).toBe(4);
});

}); });

karma start

js/fizzbuzz.js

var fizzbuzz = (function() { function process(n) { if (!(n % 15)) { return "FizzBuzz"; } if (!(n % 3)) { return "Fizz"; } if (!(n % 5)) { return "Buzz"; } return n; }

return { process: process }; })();

karma's People

Watchers

James Cloos avatar Meeraj Kanaparthi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.