I'm working on a simple testing scripts with mocha and coffeescript.
In my test folder, I have a configuration for mocha( mocha.opts ):
--compilers coffee: coffee-script/register
--reporter spec
And my testing file ( test_one.coffee ):
assert = require "assert"
describe "A feature", ->
describe "An specific function", ->
it "Should work as expected", ->
assert true
But whenever I run "mocha ." it returns me this:
assert.js:93
throw new assert.AssertionError({
AssertionError: missing path
at Module.require (module.js:363:3)
at require (module.js:380:17)
at args (C:\...\AppData\Roaming\npm\node_modules\mocha\bi
at Array.forEach (native)
at Object.<anonymous> (C:\...\AppData\Roaming\npm\node_mo
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
Any ideas of how can I fix this?
The option to pass to Mocha is: --compilers coffee:coffee-script/register
. Note the lack of space after the colon.
I believe what is happening is that with the space, it tells Mocha that to compile coffee
files, it should load a module with a path which is an empty string, and you get the error you get.