Makefile - Content:
REPORTER = dot
all: build
build:
@./node_modules/coffee-script/bin/coffee \\
-c \\
-o lib src
clean:
rm -rf li
Apparently, a change in Mocha made in April 2018 (softly) deprecated the --compilers
option. In the command line you now get:
(node:27864) DeprecationWarning: "--compilers" will be removed in a future version of Mocha; see https://git.io/vdcSr for more info
Like the link says, this can easily be fixed by just not using --compilers
and using this new (simplified) mocha.opts
options:
--require coffeescript/register
test/*.coffee
The last line is needed to make Mocha understand it should now use *.coffee
files as test files. This seems not to be covered with the --require
option.
I needed two changes to my mocha args to get this to work:
--require coffee-script/register
--compilers coffee:coffee-script/register
As of Mocha 1.0:
coffee-script is no longer supported out of the box. CS and similar transpilers may be used by mapping the file extensions (for use with --watch) and the module name. For example
--compilers coffee:coffee-script
with CoffeeScript 1.6- or--compilers coffee:coffee-script/register
with CoffeeScript 1.7+.
(Quoting http://visionmedia.github.io/mocha/#compilers-option) So, you need to add the line
--compilers coffee:coffee-script/register
or, for CS <= 1.6.x,
--compilers coffee:coffee-script
to your mocha.opts
file.
From CoffeeScript 1.7 onwards, the option should be:
--compilers coffee:coffee-script/register
An issue was filed on Mocha's github site.
with the latest update of mocha the the require statement must written in package.json file as
"mocha":{
"require":"coffeescript",
"reporter":"spec"
},
mocha --require coffeescript/register
Source: https://github.com/mochajs/mocha/wiki/compilers-deprecation