Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Karma - JS Test Runner
Search
Sebastiano Armeli
August 14, 2013
Programming
890
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Karma - JS Test Runner
Talk given at MelbJS - August 2013
Sebastiano Armeli
August 14, 2013
More Decks by Sebastiano Armeli
See All by Sebastiano Armeli
Cultivate Excellence In Engineering Teams through Continuous Software Engineering
sebarmeli
1
230
From Strategy Definition to Execution with OKRs and Roadmap
sebarmeli
0
260
From Mission to Strategy: going over OKRs and Roadmap
sebarmeli
0
330
Managing a software engineering team
sebarmeli
1
680
Enforcing coding standards in a JS project
sebarmeli
0
630
Enforcing Coding Standards
sebarmeli
1
150
ES6: The future is now
sebarmeli
2
530
EcmaScript 6 - the future is here
sebarmeli
5
7.7k
Dependency management and Package management in JavaScript
sebarmeli
0
810
Other Decks in Programming
See All in Programming
Kubernetes祭り #2 OP/ED
bells17
0
110
dotNET_vulnclicker_intro.pdf
deka_morita
0
130
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
950
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
160
R8 の設定見直しでアプリサイズ削減
andpad
0
190
Agents on Rails - Rails at Scale 2026
irinanazarova
0
520
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
360
contenteditable と日本語入力に向き合う
colorful12
0
180
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
5.8k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
350
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5k
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
480
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
370
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Bash Introduction
62gerente
615
220k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
470
Thoughts on Productivity
jonyablonski
76
5.4k
Music & Morning Musume
bryan
48
7.4k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Transcript
Karma JS Test Runner Sebastiano Armeli @sebarmeli 14/8/2013 - MelbJS
Karma JS Test Runner Sebastiano Armeli @sebarmeli
Karma JS Test Runner Sebastiano Armeli @sebarmeli
Test Framework How you write your tests
Test Environment Where you execute your tests
Test Runner How you run your test
What do we need from a Test Runner?
it (‘should be fast’)
it (‘should use real browsers’)
it (‘should be reliable’)
it (‘should be reliable’)
Karma
Client socket.io Client Client socket.io socket.io watcher reporter manager web
server preprocessor Server
Client socket.io Client Client socket.io socket.io watcher reporter manager web
server http http http preprocessor Server
Domain Specific Language (DSL) for defining tests npm install -g
karma // Ready to use
Domain Specific Language (DSL) for defining tests npm install -g
karma karma init // Create config file
Domain Specific Language (DSL) for defining tests npm install -g
karma karma init karma start // Karma starts listening
Domain Specific Language (DSL) for defining tests npm install -g
karma karma init karma start karma run // Karma runs the tests
module.exports = function(config) { config.set({ basePath: './../..', frameworks: ['jasmine', ‘requirejs’],
files: [ ‘spec/javascripts/test-main.js’, {pattern: 'spec/javascripts/fixtures/**/*.html', watched: false}, {pattern: 'app/assets/javascripts/**/*.js'}, {pattern: 'spec/javascripts/**/*.js'} ], port: 9876, //default browsers: ['Chrome’, ‘ChromeCanary’], singleRun: false, autoWatch: true }); }
Plugins Browser Launchers Test Framework Reporters Preprocessors
karma-!refox-launcher karma-safari-launcher karma-opera-launcher karma-ie-launcher
Plugins Browser Launchers Test Framework Reporters Preprocessors
karma-jasmine karma-mocha karma-qunit karma-requirejs
Plugins Browser Launchers Test Framework Reporters Preprocessors
karma-junit-reporter karma-coverage reporters: [‘junit’], junitReporter : { outputFile: 'test-reports.xml', suite:
'My Suite' } reporters: [‘coverage’], coverageReporter: { type : 'html', dir : 'coverage/' }
Plugins Browser Launchers Test Framework Reporters Preprocessors
karma-coverage preprocessors: { './app/assets/javascripts/**/*.js': 'coverage' } preprocessors: { '**/*.handlebars': 'ember'
} karma-ember-preprocessor
Running just one spec?
Running just one spec? iit(“should do something”, function(){}); ddescribe(“component”, function(){});
Debug http://localhost:9876/debug.html
Grunt-Karma karma: { ci: { configFile: 'karma.conf.js', singleRun: true, browsers:
['PhantomJS'] } }
Running on CI?
Running on CI? karma start --singleRun=true --browsers PhantomJS --reporters junit
Karma!