테스트 실행하면 fail이 나오는데 어떻게 해결해야될까요?
781
작성자 없음
작성한 질문수 0
아래 다른분이 질문하셨길래 봤는데 어디를 지워야할지 모르겠습니다
아래는 실행했을때 에러코드입니다
FAIL src/App.test.js
✕ renders learn react link (78 ms)
● renders learn react link
TestingLibraryElementError: Unable to find an element with the text: /learn react/i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
<body>
<div>
<div
class="App"
>
<header
class="App-header"
>
<img
alt="logo"
class="App-logo"
src="logo.svg"
/>
<p>
Edit
<code>
src/App.js
</code>
and save to reload.
</p>
<a
class="App-link"
href="https://reactjs.org"
rel="noopener noreferrer"
target="_blank"
>
안녕안녕
</a>
</header>
</div>
</div>
</body>
4 | test('renders learn react link', () => {
5 | render(<App />);
> 6 | const linkElement = screen.getByText(/learn react/i);
| ^
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
at Object.getElementError (node_modules/@testing-library/dom/dist/config.js:37:19)
at node_modules/@testing-library/dom/dist/query-helpers.js:90:38
at node_modules/@testing-library/dom/dist/query-helpers.js:62:17
at getByText (node_modules/@testing-library/dom/dist/query-helpers.js:111:19)
at Object.<anonymous> (src/App.test.js:6:30)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 4.242 s
Ran all test suites.
Watch Usage
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
답변 1
1
안녕하세요
보시면
테스트에서는 기대하고 있는 텍스트가
learn react
입니다 하지만
현재 App.js에서는
안녕안녕
을 출력하고 있어서 테스트에서 에러가 납니다 ~
Docker Containers간 통신 할 때 나타나는 에러 강의 질문
0
81
1
WINDOW + Vite를 사용하여 소스 코드 변경이 반영되지 않는 현상
0
80
1
도커 컨테이너 끼리 SSL 통신 시 문제가 생깁니다..
0
217
1
도표 강의 자료 사용이 불가합니다. (권한 문제)
0
139
1
Docker compose 관련 공유
0
143
1
트레비스가 유료화가 되어 테스트가 어려워 챕터8에서 고민중입니다.
0
79
1
강사님 혹시 vscode 어떤 테마 쓰시나요..?
0
287
1
The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist.
0
105
1
travis ci가 이제 유료화가 된 것 같습니다;;;
0
211
2
docker-compose up 에러 공유 드립니다
0
292
1
Elastic Beanstalk에서 도메인 클릭시 react 이미지가 안나오고 다른 화면이 나오는데
0
170
1
도커 빌드 시간이 너무 오래걸려요..
0
1067
2
docker-compose down 이후에도 containers에 redis가 남아 있는 이유
0
168
1
도커 볼륨이 작동이 안되는것 같아서 질문드립니다!
0
213
2
docker-compose 가 Docker Desktop 에서 빠진건가요? command not found 라고 뜨네요
0
281
1
Error response from daemon: The system cannot find the file specified.
0
220
1
draw.io 오류
0
655
1
Docker Volume 오류(reference, lowercase)
0
565
1
[섹션3 - 내가 만든 이미지 기억하기 쉬운 이름 주기] 네이밍/태그 에러
0
227
1
axios오류 문의드립니다!
0
334
1
node.js version
0
486
1
안녕하세요 마지막 강의 질문 있습니다.
0
436
1
Deploy를 계속 실패합니다.
3
1384
4
TravisCI에서 계속 에러가 납니다....
0
361
1





