Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

nodemon - 'mocha' is not recognized as an internal or external command, operable program or batch file.

mocha 테스트를 했더니, 다음과 같이 오류가 발생합니다.

c:\temp> nodemon --exec npm test
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `npm test`

> tests@1.0.0 test E:\nodejs\weather-app\node-tests
> mocha **/*.test.js

'mocha' is not recognized as an internal or external command, operable program or batch file.
npm ERR! Test failed.  See above for more details.
[nodemon] app crashed - waiting for file changes before starting...

간단합니다. mocha를 g 옵션 없이 설치했기 때문입니다.

c:\temp> npm i mocha --save-dev

이렇게 해야 합니다. ^^

c:\temp> npm install -g mocha --save-dev




부가적으로, nodemon을 우회해서 실행할 수 있도록 다음과 같이 설정하는 것도 가능합니다.

{
  "name": "tests",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha **/*.test.js",
    "test-watch": "nodemon --exec npm test"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "mocha": "^6.1.4"
  }
}

그래서 이렇게 "npm run [사용자_스크립트_이름]"으로 동일한 효과를 낼 수 있습니다.

c:\temp> npm run test-watch




참고로, python 스크립트를 수정해 저장하면 그 즉시 자동으로 해당 스크립트를 실행해 주는 도구가 있긴 하지만, 그냥 nodemon으로도 할 수 있습니다.

c:\temp> nodemon --exec python test.py




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/8/2019]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 76  77  78  79  [80]  81  82  83  84  85  86  87  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
11967정성태7/1/201921437개발 환경 구성: 446. Synology NAS를 Windows 10에서 iSCSI로 연결하는 방법
11966정성태6/30/201920281Math: 62. 활성화 함수에 따른 뉴런의 출력을 그리드 맵으로 시각화파일 다운로드1
11965정성태6/30/201920899.NET Framework: 846. C# - 2차원 배열을 1차원 배열로 나열하는 확장 메서드파일 다운로드1
11964정성태6/30/201921944Linux: 20. C# - Linux에서의 Named Pipe를 이용한 통신
11963정성태6/29/201921657Linux: 19. C# - .NET Core Unix Domain Socket 사용 예제
11962정성태6/27/201919262Math: 61. C# - 로지스틱 회귀를 이용한 선형분리 불가능 문제의 분류파일 다운로드1
11961정성태6/27/201919406Graphics: 37. C# - PLplot - 출력 모음(Family File Output)
11960정성태6/27/201920453Graphics: 36. C# - PLplot의 16색 이상을 표현하는 방법과 subpage를 이용한 그리드 맵 표현
11959정성태6/27/201921550Graphics: 35. matplotlib와 PLplot의 한글 처리
11958정성태6/25/201925963Linux: 18. C# - .NET Core Console로 리눅스 daemon 프로그램 만드는 방법 [6]
11957정성태6/24/201923748Windows: 160. WMI 쿼리를 명령행에서 간단하게 수행하는 wmic.exe [2]
11956정성태6/24/201922938Linux: 17. CentOS 7에서 .NET Core Web App 실행 환경 구성 [1]
11955정성태6/20/201921093Math: 60. C# - 로지스틱 회귀를 이용한 분류파일 다운로드1
11954정성태6/20/201919431오류 유형: 550. scp - sudo: no tty present and no askpass program specified
11953정성태6/20/201917355오류 유형: 549. The library 'libhostpolicy.so' required to execute the application was not found in '...'
11952정성태6/20/201918399Linux: 16. 우분투, Centos의 Netbios 호스트 이름 풀이 방법
11951정성태6/20/201921599오류 유형: 548. scp 연결 시 "Permission denied" 오류 및 "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" 경고
11950정성태6/18/201922371.NET Framework: 845. C# - 윈도우 작업 관리자와 리소스 모니터의 메모리 값을 구하는 방법
11949정성태6/18/201917524오류 유형: 547. CoreCLR Profiler 예제 프로젝트 빌드 시 컴파일 오류 유형
11948정성태6/17/201919462Linux: 15. 리눅스 환경의 Visual Studio Code에서 TFS 서버 연동
11947정성태6/17/201921921Linux: 14. 리눅스 환경에서 TFS 서버 연동
11946정성태6/17/201922811개발 환경 구성: 445. C# - MathNet으로 정규 분포를 따르는 데이터를 생성, PLplot으로 Histogram 표현파일 다운로드1
11945정성태6/17/201920384Linux: 13. node.js에서 syslog로 출력하는 방법
11944정성태6/16/201926707Linux: 12. Ubuntu 16.04/18.04에서 node.js 최신 버전 설치 방법
11943정성태6/15/201920016.NET Framework: 844. C# - 박싱과 언박싱 [1]
11942정성태6/13/201925774개발 환경 구성: 444. 로컬의 Visual Studio Code로 원격 리눅스 머신에 접속해 개발하는 방법 [1]
... 76  77  78  79  [80]  81  82  83  84  85  86  87  88  89  90  ...