You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quote the glob, "./test/**/*.spec.ts" instead of ./test/**/*.spec.ts, so the shell doesn't interpret the **. (Most shells treat that as including any number of directories, but it's technically an extension and isn't enabled in all of them by default; quoting forces the original glob to be passed to Mocha, which interprets it the same no matter which OS or shell it's inside.) If for some reason that doesn't resolve your issue, please let us know!
Tangentially, --recursive doesn't typically affect globs one way or the other; at least, it doesn't affect glob interpretation (* is never recursive and **in Mocha is always recursive), and won't kick in when the glob only matches files (I'm not certain whether it comes into play when a glob matches a directory; I haven't ever had a reason to try). It changes whether Mocha looks for JS files inside subdirectories or only that exact directory when a directory is specified as the filepath. (So, for instance, if your tests are all JS files somewhere under the default test folder, you can put --recursive in mocha.opts to make Mocha run all the tests by default without having specified a path/glob, then specify a path/glob when running it to effectively override that and run only some files. In fact, I'm not sure what other good use cases it has.)
(Also, ./test/mocha.opts is the default opts file location, so you should be able to omit the --opts parameter when it's at that path.)
Using this script:
I've tried to load some test files inside the tree:
The
authentications.spec.ts
test file gets loaded but theusers.spec.ts
doesn't.My mocha.opts file looks like just:
I've also tried to remove the
--recursive
flag and just have a glob but it doesn't work.I can't work out whether the problem is with
ts-node
or withmocha
?Any ideas?
The text was updated successfully, but these errors were encountered: