---
title: "Property 'toEqual' does not exist on type 'Assertion'"
description: "cypress를 도입하면서, jest의 toEqual 프로퍼티를 찾지 못하는 현상이 발생하였습니다."
date: 2023-06-11
tags: [javascript, testing]
sections: [technical]
draft: false
---


## 현상

cypress를 도입하면서, jest의 toEqual 프로퍼티를 찾지 못하는 현상이 발생하였습니다.

![](https://velog.velcdn.com/images/ksr20612/post/d142ec39-be96-409c-be4c-e8465bfb1850/image.png)

## 원인

- 사용된 expect가 예상과는 달랐습니다.
![](https://velog.velcdn.com/images/ksr20612/post/1063f494-0a44-44be-b4cc-a892d5f44af5/image.png)
- 서치해보니, cypress v10과 jest의 expect를 동시 사용시에 충돌이 발생한다고 합니다.
https://github.com/cypress-io/cypress/issues/22059#issuecomment-1148921141

## 해결

### 첫번째 방법 : @jest/globals에서 expect를 import 해오기
	
	import { expect } from '@jest/globals';
	
### 두번째 방법 : tsconfig.json에서 cypress.config.ts를 제외 설정해주기
```
"exclude": [
 "./cypress.config.ts",
 //other exclusions that may help https://github.com/cypress-io/cypress/issues/22059#issuecomment-1428298264
 "node_modules",
 "cypress",
 "**/*.cy.tsx"
]
```
