Nodemon: ν…ŒμŠ€νŠΈ λŸ¬λ„ˆμ™€ ν•¨κ»˜ nodemon을 μ‚¬μš©ν•˜λŠ” μ˜¬λ°”λ₯Έ 방법은 λ¬΄μ—‡μž…λ‹ˆκΉŒ?

에 λ§Œλ“  2015λ…„ 02μ›” 08일  Β·  12μ½”λ©˜νŠΈ  Β·  좜처: remy/nodemon

mocha 등을 μ‚¬μš©ν•˜μ—¬ ν…ŒμŠ€νŠΈλ₯Ό μ‹€ν–‰ν•  λ•Œ ν…ŒμŠ€νŠΈκ°€ μ‹€νŒ¨ν•˜μ—¬ λŸ¬λ„ˆκ°€ 0이 μ•„λ‹Œ μƒνƒœ μ½”λ“œλ‘œ μ’…λ£Œλ˜λ©΄ nodemon은 ν”„λ‘œμ„ΈμŠ€μ— λ¬Έμ œκ°€ μžˆλ‹€κ³  μƒκ°ν•˜κ³  λ³€κ²½ 사항을 ν™•μΈν•˜μ§€ μ•Šκ³  μ’…λ£Œλ©λ‹ˆλ‹€. 이 λ™μž‘μ„ μ˜΅νŠΈμ•„μ›ƒν•  수 μžˆλŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

stale

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

λ‚˜μ€‘μ— λ“€μ–΄μ˜€λŠ” μ‚¬λžŒμ€ || true λ₯Ό μΆ”κ°€ν•˜μ—¬ nodemon이 μ„±κ³΅ν–ˆλ‹€κ³  μƒκ°ν•˜λ„λ‘ μ†μž„μœΌλ‘œμ¨ 이 문제λ₯Ό ν•΄κ²°ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

nodemon --exec "your_command_stuff || true"

λͺ¨λ“  12 λŒ“κΈ€

λ‹€μŒμ€ 좜λ ₯μž…λ‹ˆλ‹€. btw. λ³΄μ‹œλ‹€μ‹œν”Ό package.json에 μ •μ˜λœ 슀크립트λ₯Ό μ‚¬μš©ν•˜μ—¬ nodemonκ³Ό mocha( nodemon -x "_mocha -R min $@" ,)λ₯Ό μ‹€ν–‰ν•˜λŠ”λ° 이것이 차이가 μžˆλŠ”μ§€ ν™•μ‹€ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

$ npm run test-dev

> [email protected] test-dev /Users/mstade/dev/funkis
> nodemon -x "_mocha -R min $@"

8 Feb 15:57:48 - [nodemon] v1.3.6
8 Feb 15:57:48 - [nodemon] to restart at any time, enter `rs`
8 Feb 15:57:48 - [nodemon] watching: *.*
8 Feb 15:57:48 - [nodemon] starting `_mocha -R min `


  545 passing (670ms)
  2 failing

  1) Protocol when called with an empty signatures object should throw a TypeError:
     AssertionError: function (rest) { return apply(fn, this, argc, arguments) } must throw function TypeError() { [native code] }
      at Context.<anonymous> (/Users/mstade/dev/funkis/test/Protocol.js:15:39)
      at Test.Runnable.run (/Users/mstade/dev/funkis/node_modules/mocha/lib/runnable.js:221:32)
      at Runner.runTest (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:374:10)
      at /Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:452:12
      at next (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:299:14)
      at /Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:309:7
      at next (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:247:23)
      at Immediate._onImmediate (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:321:17)

  2) Protocol when called with a name, and some signatures should set immutable and enumerable properties on the protocol:
     TypeError: Signatures must be an object.
      at TypeError (native)
      at new Protocol (/Users/mstade/dev/funkis/lib/Protocol.js:8:34)
      at Protocol (/Users/mstade/dev/funkis/lib/Protocol.js:5:12)
      at Context.<anonymous> (/Users/mstade/dev/funkis/test/Protocol.js:21:15)
      at Test.Runnable.run (/Users/mstade/dev/funkis/node_modules/mocha/lib/runnable.js:221:32)
      at Runner.runTest (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:374:10)
      at /Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:452:12
      at next (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:299:14)
      at /Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:309:7
      at next (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:247:23)
      at Immediate._onImmediate (/Users/mstade/dev/funkis/node_modules/mocha/lib/runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:321:17)



util.error: Use console.error instead
[nodemon] failed to start process, possible issue with exec arguments
exception in nodemon killing node
Error: Uncaught, unspecified "error" event.
    at Error (native)
    at emit (events.js:78:13)
    at ChildProcess.<anonymous> (/Users/mstade/dev/funkis/node_modules/nodemon/lib/monitor/run.js:133:11)
    at ChildProcess.emit (events.js:101:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1038:12)

----------------------------------------------------------
If appropriate, please file an error with the output from:
$ node /Users/mstade/dev/funkis/node_modules/.bin/nodemon -x _mocha -R min  --dump
At http://github.com/remy/nodemon/issues/new
----------------------------------------------------------


npm ERR! Darwin 14.1.0
npm ERR! argv "/usr/local/opt/nvm/versions/io.js/v1.0.4/bin/iojs" "/usr/local/opt/nvm/versions/io.js/v1.0.4/bin/npm" "run" "test-dev"
npm ERR! node v1.0.4
npm ERR! npm  v2.3.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test-dev: `nodemon -x "_mocha -R min $@"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test-dev script 'nodemon -x "_mocha -R min $@"'.
npm ERR! This is most likely a problem with the funkis package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nodemon -x "_mocha -R min $@"
npm ERR! You can get their info via:
npm ERR!     npm owner ls funkis
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mstade/dev/funkis/npm-debug.log

예, 이것은 _ν•΄μ•Ό ν•©λ‹ˆλ‹€_. λ‹€λ₯Έ ν”„λ‘œμ νŠΈμ—μ„œλ„ λΉ„μŠ·ν•œ 일을 ν•©λ‹ˆλ‹€. $@ 와 관련이 μžˆλ‹€λŠ” _λŠλ‚Œ_이 μžˆμŠ΅λ‹ˆλ‹€. μ΄κ²ƒμ˜ κ°€μΉ˜λŠ” 무엇이라고 μ˜ˆμƒν•˜μ‹­λ‹ˆκΉŒ?

μ–΄λ–€ ν…ŒμŠ€νŠΈλ₯Ό 싀행할지 λ²”μœ„λ₯Ό μ§€μ •ν•˜κ³  ν•„μš”ν•œ 경우 Mocha에 μΆ”κ°€ λ§€κ°œλ³€μˆ˜λ₯Ό μ „λ‹¬ν•˜κΈ° μœ„ν•΄ 가끔 μ‚¬μš©ν•©λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ 그것은 잘 μž‘λ™ν•©λ‹ˆλ‹€. 이것은 λ‚΄κ°€ 직접 λ˜μ§€κ±°λ‚˜ booboos λ•Œλ¬Έμ— λ‚΄ μ½”λ“œμ— μ˜ˆμ™Έκ°€ μžˆμ„ λ•Œλ§ˆλ‹€ μ‹€νŒ¨ν•©λ‹ˆλ‹€. 이전에 mocha -w ν–ˆμ§€λ§Œ μ˜ˆμ™Έλ₯Ό μ²˜λ¦¬ν•˜λŠ” 데 μ•…λͺ…이 λ†’μ•˜κ³  nodemon이 μ•„λ¦„λ‹΅κ²Œ μˆ˜ν–‰ν•˜λŠ” ν”„λ‘œμ νŠΈμ˜ λ‹€λ₯Έ κ³³μ—μ„œ λ³€κ²½ 사항을 μ„ νƒν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” μ•žμœΌλ‘œ λ©°μΉ  μ•ˆμ— 더 μž‘μ€ μž¬ν˜„ μΌ€μ΄μŠ€λ₯Ό 생각해낼 수 μžˆλŠ”μ§€ μ•Œμ•„λ³΄κ² μŠ΅λ‹ˆλ‹€. μˆ˜μ • 및 PR에 λŒ€ν•΄μ„œλ„ λ³Ό 수 μžˆμ§€λ§Œ μ‹œκ°„μ΄ 없을 것 κ°™μ•„μ„œ λ„ˆλ¬΄ μ•½μ†ν•˜μ§€ μ•ŠλŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

@mstade λ‚˜λŠ” 이것이 1.3.x의 νšŒκ·€λΌκ³  μƒκ°ν•©λ‹ˆλ‹€. 1.2.x둜 λŒμ•„κ°€κ²Œ λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€.

$npm μ‹€ν–‰ ν…ŒμŠ€νŠΈλ₯Ό μˆ˜ν–‰ν•  λ•Œ λ™μΌν•œ λ¬Έμ œκ°€ λ°œμƒν•©λ‹ˆλ‹€.

[nodemon] failed to start process, possible issue with exec arguments     
events.js:146                                                                        
    throw err;                                                                     
    ^                                                                             

Error: Uncaught, unspecified "error" event. (2)    
   at emit (events.js:144:17)        
   at ChildProcess.<anonymous> (/usr/lib/node_modules/nodemon/lib/monitor/run.js:124:11)      
   at emitTwo (events.js:87:13)        
   at ChildProcess.emit (events.js:172:7)     
   at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)  

λ‚΄ package.json 슀크립트

"scripts": {
    "server": "nodemon ./server.js localhost 5000",  
    "test": "PORT=8000 nodemon --ext js --watch ./ --exec 'mocha ./test' --delay 1"  
 },

λ‚˜μ€‘μ— λ“€μ–΄μ˜€λŠ” μ‚¬λžŒμ€ || true λ₯Ό μΆ”κ°€ν•˜μ—¬ nodemon이 μ„±κ³΅ν–ˆλ‹€κ³  μƒκ°ν•˜λ„λ‘ μ†μž„μœΌλ‘œμ¨ 이 문제λ₯Ό ν•΄κ²°ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

nodemon --exec "your_command_stuff || true"

이것은 ν”„λ‘œμ„ΈμŠ€κ°€ 였λ₯˜ μ½”λ“œ 2와 ν•¨κ»˜ μ’…λ£Œλ  λ•Œ 특히 λ°œμƒν•œλ‹€κ³  λ³΄κ³ ν•˜λŠ” #627의 볡제본인 것 κ°™μŠ΅λ‹ˆλ‹€. ENOENT: No such file or directory

@jayphelps 정말 κ°μ‚¬ν•©λ‹ˆλ‹€.

λ‚΄ ν…ŒμŠ€νŠΈ μŠ€ν¬λ¦½νŠΈλŠ” λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€. λˆ„κ΅°κ°€μ—κ²Œ 도움이 되기λ₯Ό λ°”λžλ‹ˆλ‹€!

"test": "nodemon --watch . --exec 'mocha ./test/index.js || true'"

이 λ¬Έμ œλŠ” 졜근 ν™œλ™μ΄ μ—†μ—ˆκΈ° λ•Œλ¬Έμ— 유휴 μƒνƒœλ‘œ μžλ™ ν‘œμ‹œλ˜μ—ˆμŠ΅λ‹ˆλ‹€. 더 이상 ν™œλ™μ΄ λ°œμƒν•˜μ§€ μ•ŠμœΌλ©΄ μžλ™μœΌλ‘œ λ‹«νž™λ‹ˆλ‹€. 이것이 잘λͺ»λ˜μ—ˆλ‹€κ³  μƒκ°ν•˜κ±°λ‚˜ λ¬Έμ œκ°€ μ—¬μ „νžˆ μ§€μ†λ˜λŠ” 경우 λŒ“κΈ€μ— λ‹΅μž₯을 μž…λ ₯ν•˜λ©΄ @remy κ°€ (μ‹œλ„!) 후속 쑰치λ₯Ό
κΈ°μ—¬ν•΄μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€ <3

이것을 μ‚¬μš©ν•΄λ³΄μ‹­μ‹œμ˜€

nodemon --exec mocha -R min

μž‘μ€λ”°μ˜΄ν‘œλ‚˜ ν°λ”°μ˜΄ν‘œλ₯Ό μ‚¬μš©ν•˜μ§€ λ§ˆμ‹­μ‹œμ˜€.

"test": "NODE_ENV=test nodemon --exec mocha --exit -R spec"

그리고 μ‹€ν–‰ν•˜λ©΄:

npm test dir/file.js

dir/file.js κ°€ ν…ŒμŠ€νŠΈ μŠ€ν¬λ¦½νŠΈμ— μΆ”κ°€λ˜λ―€λ‘œ κ°œλ³„ νŒŒμΌμ„ ν…ŒμŠ€νŠΈν•  수 μžˆμŠ΅λ‹ˆλ‹€.

νŒŒμΌμ„ λΉ λ₯΄κ²Œ 두 번 μ €μž₯ν•˜λ©΄ ν…ŒμŠ€νŠΈλ„ 두 번 μ‹€ν–‰λ˜λ―€λ‘œ λ°”λžŒμ§ν•˜μ§€ μ•Šμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.

이것은 λ‚˜λ₯Ό μœ„ν•΄ μΌν–ˆμŠ΅λ‹ˆλ‹€.
"start": "nodemon ./bin/www --exec mocha ./test.js -R min"

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰