<aside> 💻

트러블 슈팅

전체 트러블 슈팅

1. Jest 설정 초기 에러

Error: Jest encountered an unexpected token
// jest.config.cjs
module.exports = {
  preset: "ts-jest",
  testEnvironment: "jest-environment-jsdom",
  transform: {
    "^.+\\\\.(ts|tsx)$": "ts-jest"
  }
};

2. Module Resolution 에러

Cannot find module '@/components/...' or its corresponding type declarations
moduleNameMapper: {
  "^@/(.*)$": "<rootDir>/src/$1"
}

3. TextEncoder 에러

ReferenceError: TextEncoder is not defined
import { TextEncoder, TextDecoder } from 'util';
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;

4. Testing Library 타입 에러

Property 'toBeInTheDocument' does not exist on type 'Matchers<any>'