testing

test / it // 첫번째 파라미터: 작성한 테스트코드가 무엇을 하는지 이름을 정해준다 // 두번째 파라미터: 해당 테스트코드 로직 test('properly adds two numbers', () => { // expected result expect(sum(1, 2)).toBe(3); }); // 혹은, it keyword를 사용한 테스트 코드 작성 it('properly adds two numbers', () => { expect(sum(1, 2)).toBe(3); }); 동작은 둘다 동일. 테스트 하나를 작성할 때 사용하는 키워드. Describe 테스트를 그룹화할 수 있다 이는 필수 사항이 아니다. test최상위 수준에서 직접 블록을 작성할 수 있다. 그러나, 테스트를 그룹으로 구성하려는 경..
설치 yarn add -D jest yarn add -D @types/jest jest 설정파일 추가 jest --init ✔ Would you like to use Typescript for the configuration file? … 타입스크립트 파일로 설정할까? 난 no ✔ Choose the test environment that will be used for testing › 어떤 환경에서 test 돌릴거니? 난 node ✔ Do you want Jest to add coverage reports? … 커버리지 기능을 사용할거니 ? yes ✔ Which provider should be used to instrument code for coverage? › 본인은 babel ✔ Automati..
Bㅐ추
'testing' 태그의 글 목록