mocha λ±μ μ¬μ©νμ¬ ν μ€νΈλ₯Ό μ€νν λ ν μ€νΈκ° μ€ν¨νμ¬ λ¬λκ° 0μ΄ μλ μν μ½λλ‘ μ’ λ£λλ©΄ nodemonμ νλ‘μΈμ€μ λ¬Έμ κ° μλ€κ³ μκ°νκ³ λ³κ²½ μ¬νμ νμΈνμ§ μκ³ μ’ λ£λ©λλ€. μ΄ λμμ μ΅νΈμμν μ μλ λ°©λ²μ΄ μμ΅λκΉ?
λ€μμ μΆλ ₯μ
λλ€. 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"
κ°μ₯ μ μ©ν λκΈ
λμ€μ λ€μ΄μ€λ μ¬λμ
|| true
λ₯Ό μΆκ°νμ¬ nodemonμ΄ μ±κ³΅νλ€κ³ μκ°νλλ‘ μμμΌλ‘μ¨ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μμ΅λλ€.