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
Jest - Do more, spend less time
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Christian Fortes
April 02, 2018
Programming
0
36
Jest - Do more, spend less time
Christian Fortes
April 02, 2018
Tweet
Share
More Decks by Christian Fortes
See All by Christian Fortes
Tech Track - Angular 2 (Part 2)
chrisgfortes
0
51
Tech Track - Angular 2 (Part 3)
chrisgfortes
0
31
Tech Track - Angular 2 (Part 1)
chrisgfortes
0
52
Uma breve introdução sobre AngularJS 1.x
chrisgfortes
0
28
Other Decks in Programming
See All in Programming
Basic Architectures
denyspoltorak
0
680
CSC307 Lecture 03
javiergs
PRO
1
490
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
CSC307 Lecture 02
javiergs
PRO
1
780
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
AI巻き込み型コードレビューのススメ
nealle
2
420
Oxlint JS plugins
kazupon
1
980
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
290
Fluid Templating in TYPO3 14
s2b
0
130
AtCoder Conference 2025
shindannin
0
1.1k
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
140
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
590
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
WCS-LA-2024
lcolladotor
0
450
How to Ace a Technical Interview
jacobian
281
24k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
Transcript
Jest Do more, spend less time
Jest @chrisgfortes Jest? O que é? - Delightful JavaScript Testing
- Designed for React / ES6 - Developed by Facebook
Jest @chrisgfortes - Easy setup - Built-in code coverage reports
- Powerful mocking library - Snapshot Testing - Works with TypeScript - Complete library (No dependencies) Mas por que usar?
Jest @chrisgfortes Exemplo
Jest @chrisgfortes Código function sum(a, b) { return a +
b; } module.exports = sum; sum.js
Jest @chrisgfortes Escrevendo o teste const sum = require('./sum'); test('adds
1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(3); }); sum.test.js
Jest @chrisgfortes Install and Run console$ npm install --save-dev jest
console$ jest
Jest @chrisgfortes Result PASS ./sum.test.js ✓ adds 1 + 2
to equal 3 (5ms)
Jest @chrisgfortes Mas cadê a configuração????
Jest @chrisgfortes Zero configuration!!!!!!
Jest @chrisgfortes - sum.js (write a code js) - sum.test.js
(write your test) - Run a command (jest) Configuração é:
Jest @chrisgfortes Coverage console$ jest --coverage --collectCoverageFrom=[src/**/*.js]
Jest @chrisgfortes Coverage result:
Jest @chrisgfortes Reports (Istanbul) Jest use the report of Istanbul
https://github.com/gotwarlost/istanbul
Jest @chrisgfortes config.json { "verbose": true, "rootDir": "../../", "coverageDirectory": "test/coverage/",
"coverageReporters": [ "html" ], "collectCoverage": true, "collectCoverageFrom": [ "src/**/*.js", "!**/node_modules/**" ] }
Jest @chrisgfortes Usando config.json console$ jest -c ./config.json console$ jest
-c ./config.json --watchAll (Watch mode)
Jest Thanks! @chrisgfortes