git에 push 과정중 circleCI 오류 해결

Steve·2022년 4월 21일
0

circleCI 에러..

이미 push 후 PR까지 한 것에 대해 수정요청이 왔다.
"기존 구독신청에서 신문구독으로 텍스트 수정하는 간단작업"

☠️ 이.지.만..!

ARC통해 변경 및 Push를 하니
엥??
circleCI 오류랜다.
읽어보니..

Summary of all failing tests
 FAIL  components/features/global/nav/_children/auth-menu/index.test.jsx
  ● <AuthMenu> › should match snapshot

    expect(received).toMatchSnapshot()

    Snapshot name: `<AuthMenu> should match snapshot 1`

    - Snapshot
    + Received

    - <Link
    + <div
        className="flex flex--justify-end flex--align-items-center"
    -   href="/subscribe/signin/"
      >
        <Login
          type="sm"
        />
    - </Link>
    + </div>

      22 |   it('should match snapshot', () => {
      23 |     const wrapper = shallow(<AuthMenu {...props} />);
    > 24 |     expect(toJSON(wrapper)).toMatchSnapshot();
         |                             ^
      25 |   });
      26 | });
      27 | 

      at Object.<anonymous> (components/features/global/nav/_children/auth-menu/index.test.jsx:24:29)


Snapshot Summary
 › 1 snapshot failed from 1 test suite. Inspect your code changes or run `npm test -- -u` to update them.

Test Suites: 1 failed, 334 passed, 335 total
Tests:       1 failed, 7 skipped, 1 todo, 2296 passed, 2305 total
Snapshots:   1 failed, 165 passed, 166 total
Time:        90.491s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Chosun-PageBuilder-Fusion-Features@0.0.0 test: `jest --coverage --maxWorkers 4`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Chosun-PageBuilder-Fusion-Features@0.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2022-04-27T05_36_57_947Z-debug.log

Exited with code exit status 1

해결1

  1. test 과정에서 'default.test.jsx'에서 'should match snapshot'문제라고 떳고,
  2. This is probably not a problem with npm. There is likely additional logging output above.
    "npm의 문제가 아닙니다. 위에 추가 로깅 출력이 있을 수 있습니다(?)"
    이라는 에러 문구가 있었습니다.뭔소릴까.
    이에 대한 해결책은 아래 순서로 해결할 수 있었다.
  1. npm cache 삭제
    • npm cache clean -f
  2. node_moudles,package-lock.json삭제
    • rm -rf node_modules
  3. npm 재설치
    • npm install

해결2

위 것들보다도 근본적인 문제.
지금까지 VC의 터미널창에서 push를 해줬었고 snapshot이라는걸 안해왔다.
jest로 테스트 할일이 없었기 때문.
차장님이 하시는 방법데로, VC의 사이드바에서 +버튼으로 staging해주고,
글자를 적은 후 v표시를 누르면 commit이 명령어 없이 되는데,
이때 변화된 snapshot도 함께 staging,commit해줘야한다.
지금까진 그걸 안해주서 발생했던 문제!

그 후 최종적으로 push를 해주면 CircleCI 에러가 사라진 걸 볼 수 있다.

profile
Front-Dev

0개의 댓글