Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Karma - JS Test Runner
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Sebastiano Armeli
August 14, 2013
Programming
1
860
Karma - JS Test Runner
Talk given at MelbJS - August 2013
Sebastiano Armeli
August 14, 2013
Tweet
Share
More Decks by Sebastiano Armeli
See All by Sebastiano Armeli
Cultivate Excellence In Engineering Teams through Continuous Software Engineering
sebarmeli
1
190
From Strategy Definition to Execution with OKRs and Roadmap
sebarmeli
0
190
From Mission to Strategy: going over OKRs and Roadmap
sebarmeli
0
300
Managing a software engineering team
sebarmeli
1
630
Enforcing coding standards in a JS project
sebarmeli
0
600
Enforcing Coding Standards
sebarmeli
1
120
ES6: The future is now
sebarmeli
2
500
EcmaScript 6 - the future is here
sebarmeli
5
7.4k
Dependency management and Package management in JavaScript
sebarmeli
0
760
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
310
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
6.1k
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
ぼくの開発環境2026
yuzneri
1
290
Ruby x Terminal
a_matsuda
5
510
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
8
2.1k
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
310
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
2k
AI活用のコスパを最大化する方法
ochtum
0
120
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
2.9k
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
150
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
95
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
130
My Coaching Mixtape
mlcsv
0
63
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
2
65
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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!