truffle test 실행 시 아무런 반응이 없는 이슈

2022. 4. 2. 10:48개발 잡부/블록체인

728x90

개요

// 메타코인 Boxes 사용
truffle unbox metacoin

// 컴파일
truffle compile

// 테스트 (멈춤)
truffle test

이 상황에서 truffle test를 실행 시
프롬포트가 멈춤(아무런 출력이 없음) 현상이 존재.


원인

module.exports = {
  // Uncommenting the defaults below
  // provides for an easier quick-start with Ganache.
  // You can also follow this format for other networks.
  // See details at: https://trufflesuite.com/docs/truffle/reference/configuration
  // on how to specify configuration options!
  //
  //networks: {
  //  development: {
  //    host: "127.0.0.1",
  //    port: 7545,
  //    network_id: "*"
  //  },

turffle unbox를 하면 truffle-config.js의 내부가
비어있는 상태로 생성된다.

연결된 개발용 네트워크가 없기 때문에,
어느곳에도 연결하지 못하고 멍때리는 것이다
(에러를 뱉어줘야 하는거 아닌가 이거)

결론적으로 이 truffle설정 파일을 수정하면 된다.


해결

truffle-config.js를 수정한다.

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"
    }
  }
  // ...
}