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
170
From Strategy Definition to Execution with OKRs and Roadmap
sebarmeli
0
160
From Mission to Strategy: going over OKRs and Roadmap
sebarmeli
0
280
Managing a software engineering team
sebarmeli
1
600
Enforcing coding standards in a JS project
sebarmeli
0
590
Enforcing Coding Standards
sebarmeli
1
120
ES6: The future is now
sebarmeli
2
480
EcmaScript 6 - the future is here
sebarmeli
5
7.3k
Dependency management and Package management in JavaScript
sebarmeli
0
740
Other Decks in Programming
See All in Programming
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
320
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
190
なんでRustの環境構築してないのにRust製のツールが動くの? / Why Do Rust-Based Tools Run Without a Rust Environment?
ssssota
7
13k
Go言語はstack overflowの夢を見るか?
logica0419
0
520
AkarengaLT vol.38
hashimoto_kei
1
110
NIKKEI Tech Talk#38
cipepser
0
130
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
200
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
150
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
190
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
2
300
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
6
3k
Featured
See All Featured
Visualization
eitanlees
149
16k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
54k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Writing Fast Ruby
sferik
629
62k
Balancing Empowerment & Direction
lara
5
700
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Optimizing for Happiness
mojombo
379
70k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Speed Design
sergeychernyshev
32
1.2k
Docker and Python
trallard
46
3.6k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
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!