Git Product home page Git Product logo

week-4's Introduction

Week 4: Testing and Karma

In Class

Adding Karma

we'll do this part together

  1. Clone this repository
  2. Run karma init
  3. Choose "Jasmine"
  4. Choose yes to use RequireJS
  5. Choose Chrome
  6. Locations of the source files: * js/vendors/**/*.js * js/app/**/*.js * js/tests/**/*Spec.js
  7. Jasmine should be excluded js/vendors/jasmine-core
  8. Choose yes to get a sample config file
  9. Choose yes to watch all the files

Add some tests on the fly

this is something you'll do

  1. Split your screen so you can see the editor and the console at the same time
  2. Add a new spec file for the Song model
  3. Add a test that makes sure the first character is uppercase
  4. Add that functionality to the Song constructor, just make sure the first character is uppercase
  5. Watch the magic!

Make some changes to the config

this is something you'll do

  1. Change the default running browser to PhantomJS
  • you'll need to npm install karma-phantomjs I'd suggest doing it globally
  1. Comment out the jasmine exclude and restart karma
  2. Turn off autowatch
  3. Restart karma: karma start
  4. Open a different terminal window
  5. Run karma run, the tests should have run, and you'll see the results in the other window * We don't always want Karma to control when the tests are run, like next week

week-4's People

Contributors

jazahn avatar dominickp avatar

Watchers

James Cloos avatar  avatar  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.