일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 블로그 서비스 최적화
- 전역변수의문제점
- Set과 Map
- 자바스크립트 딥다이브
- 비전공이지만 개발자로 먹고삽니다
- 스코프
- DOM
- 프로퍼티 어트리뷰트
- var 사용금지
- const
- 디스트럭처링
- 이미지 갤러리 최적화
- 프로그래머스
- 제너레이터와 async/await
- 자바스크립트 패턴
- peerdependencies
- 딥다이브
- 프론트엔드 성능 최적화 가이드
- ES6함수 추가기능
- 인터넷 장비
- 모던 자바스크립트 Deep Dive
- Babel과 Webpack
- package management
- Property Attribute
- 자바스크립트
- 커리어
- 이벤트
- 브라우저의 렌더링 과정
- 빌트인 객체
- 올림픽 통계 서비스 최적화
- Today
- Total
Dev Blog
Section9: Testing & the DOM(Frontend Javascript Testing) 본문
Section9: Testing & the DOM(Frontend Javascript Testing)
Nomad 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 |