Skip to content

CSCI-E32/Week-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Week 4: Testing and Karma

In Class

Adding Karma

we'll do this part together

sudo npm install -g karma
sudo npm install -g karma-jasmine karma-requirejs
sudo npm install -g karma-chrome-launcher karma-phantomjs-launcher
  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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published