Skip to content

joellobo/jest-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

## Jest ##

http://jestjs.io/

git clone https://github.com/joellobo/jest-playground.git

# 1
mkdir new-test
cd new-test

yarn --init
yarn add --dev jest

jest --init
mkdir src
cd src
touch sum.js

--
function sum(a, b) {
    return a + b;
}
module.exports = sum;
--

cd ..

mkdir "__tests__"
cd "__tests__" 
touch sum.test.js

--
const sum = require('../src/sum');

test('adds 1 + 2 to equal 3', () => {
  expect(sum(1, 2)).toBe(3);
});
--

cd ..

vim package.json

  "scripts": {
    "test": "jest"
  },

yarn test

rm -R new-test/

About

Jest Playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published