React는 CRA로 프로젝트 생성하면 jest가 포함되어 있는데, Next.js는 포함이 안되어있어서 따로 설치를 해야한답.
- js 관련 라이브러리 설치
npm i -D jest ts-jest @types/jest
2. package.json에 jest관련 설정
"jest": {
    "transform": {
      "^.+\\.ts$": "ts-jest"
    },
    "testRegex": "\\.test\\.ts$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "json"
    ],
    "globals": {
      "ts-jest": {
        "diagnostics": true
      }
    }
  }3. package.json – scripts에 test 추가
“test”: “jest –detectOpenHandles –forceExit”,
3. 테스트해보기
/* test > app.test.ts */
describe('Test', () => {
  function Test() {
    return 'hi';
  }
  it('say hello', () => {
    expect(Test()).toBe('hi');
  });
});
export {};
npm run test

4. 성공!
