일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 타입변환과단축평가
- 디스트럭처링
- 네트워크 연결과 구성요소
- 자바스크립트
- 이미지 갤러리 최적화
- 기술컨퍼런스
- 인터넷 장비
- 딥다이브
- 이벤트
- Property Attribute
- 제너레이터와 async/await
- 프로그래머스
- 비전공이지만 개발자로 먹고삽니다
- 빌트인 객체
- var 사용금지
- 원시값과객체의비교
- const
- 모던 자바스크립트 Deep Dive
- 전역변수의문제점
- ES6함수 추가기능
- 프론트엔드 성능 최적화 가이드
- 스코프
- Set과 Map
- 프로퍼티 어트리뷰트
- DOM
- 브라우저의 렌더링 과정
- 자바스크립트 딥다이브
- 블로그 서비스 최적화
- 올림픽 통계 서비스 최적화
- Babel과 Webpack
- Today
- Total
JDevBlog
Section9: Testing & the DOM(Frontend Javascript Testing) 본문
Section9: Testing & the DOM(Frontend Javascript Testing)
Jay___Kim 2023. 4. 5. 06:45Accessing The DOM from Inside Tests
- DOM vs NodeJS Environment
- Accessing the DOM
- Specialized Libraries
Should set testing environment in package.json or right in the single file as jsdom or happy-dom for emulation.
Set up testing to access html page content rendered at document of virtual window.
fs and path are still available because all the Node APIs available inside the test files.
the Dom is only emulated virtually.
Remember that we are using same document for tests. Thus, should reset before each test.
if building more complex front-end apps, the features provided by JS DOM, Happy DOM might suffice or might be a bit too clunky. means too much code to write to select elements.
In this case, Third party Library, Testing Library is recommended.
This is awesome for Unit tests and integration tests for front-end.
It also supports all popular libraries such as DOM Testing library, React Testing Library, Native Testing Library and so on.
'Online Lectures > JavaScript Unit Testing - The Practical' 카테고리의 다른 글
Section8: More on Mocking & Diving Deeper (0) | 2023.04.05 |
---|---|
Section7: Mocking & Spies: Dealing with Side Effects (0) | 2023.04.05 |
Section6: Advanced Testing Concepts (0) | 2023.04.05 |
Section 5: Integration Tests (0) | 2023.04.05 |
Section 4: Writing Good Tests (0) | 2023.04.05 |