I currently have my NodeJS source files in src
and test suites in test
, e.g.:
/src/bar/baz/foo.js
/test/bar/baz/foo.spec.js
This leads to awkward require statements like var foo = require('../../../src/bar/baz/foo')
. And it's hard to see at a glance which source files are missing tests. I would like to instead keep my test suites in the same directory as the relevant source files:
/src/bar/baz/foo.js
/src/bar/baz/foo.spec.js
But now running mocha --recursive src
causes errors as Mocha tries to run my source files as tests.
I've seen suggestions of using find
or gulp
to filter the file list but I find it surprising that this can't be done with plain Mocha. What's the recommended way of organising files this way?
Aucun commentaire:
Enregistrer un commentaire