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
Jest - Do more, spend less time
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Christian Fortes
April 02, 2018
Programming
40
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jest - Do more, spend less time
Christian Fortes
April 02, 2018
More Decks by Christian Fortes
See All by Christian Fortes
Tech Track - Angular 2 (Part 2)
chrisgfortes
0
55
Tech Track - Angular 2 (Part 3)
chrisgfortes
0
34
Tech Track - Angular 2 (Part 1)
chrisgfortes
0
55
Uma breve introdução sobre AngularJS 1.x
chrisgfortes
0
30
Other Decks in Programming
See All in Programming
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
440
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
200
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
250
すこし踏み込む CancellationToken
htkym
2
1.7k
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
6.1k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Producing Creativity
orderedlist
PRO
348
41k
So, you think you're a good person
axbom
PRO
2
2.2k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Agile that works and the tools we love
rasmusluckow
331
22k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
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