-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started Jest
Yongku cho edited this page Aug 6, 2018
·
2 revisions
npm install --save-dev jest
export function sum (a, b) {
return a + b
}
import { sum } from './sum'
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3)
})
testEnvironment
는 기본값으로 jsdom
인데, node
로 설정하지 않으면 SecurityError: localStorage is not available for opaque origins
에러가 발생한다.
{
"scripts": {
"test": "jest"
},
"jest": {
"testEnvironment": "node"
}
}