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
Sebastiano Armeli
August 14, 2013
Programming
1
850
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
180
From Strategy Definition to Execution with OKRs and Roadmap
sebarmeli
0
180
From Mission to Strategy: going over OKRs and Roadmap
sebarmeli
0
290
Managing a software engineering team
sebarmeli
1
620
Enforcing coding standards in a JS project
sebarmeli
0
600
Enforcing Coding Standards
sebarmeli
1
120
ES6: The future is now
sebarmeli
2
490
EcmaScript 6 - the future is here
sebarmeli
5
7.3k
Dependency management and Package management in JavaScript
sebarmeli
0
750
Other Decks in Programming
See All in Programming
チームをチームにするEM
hitode909
0
450
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
420
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.6k
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
230
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
670
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
660
JETLS.jl ─ A New Language Server for Julia
abap34
2
470
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
250
TestingOsaka6_Ozono
o3
0
270
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.1k
はじめてのカスタムエージェント【GitHub Copilot Agent Mode編】
satoshi256kbyte
0
160
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
Featured
See All Featured
Between Models and Reality
mayunak
1
160
Navigating Weather and Climate Data
rabernat
0
69
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
110
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
280
How to Think Like a Performance Engineer
csswizardry
28
2.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Discover your Explorer Soul
emna__ayadi
2
1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Test your architecture with Archunit
thirion
1
2.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
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!