Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jest - Do more, spend less time

Jest - Do more, spend less time

Avatar for Christian Fortes

Christian Fortes

April 02, 2018
Tweet

More Decks by Christian Fortes

Other Decks in Programming

Transcript

  1. Jest @chrisgfortes Jest? O que é? - Delightful JavaScript Testing

    - Designed for React / ES6 - Developed by Facebook
  2. 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?
  3. 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
  4. Jest @chrisgfortes - sum.js (write a code js) - sum.test.js

    (write your test) - Run a command (jest) Configuração é:
  5. Jest @chrisgfortes config.json { "verbose": true, "rootDir": "../../", "coverageDirectory": "test/coverage/",

    "coverageReporters": [ "html" ], "collectCoverage": true, "collectCoverageFrom": [ "src/**/*.js", "!**/node_modules/**" ] }