Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Recursive / Sub-Folders #106
So what's Mocha's philosophy on sub-folders ?
I notice right now that sub-folders for instance ./test/bugs/* would not be run with your standard
Is it best practice not to use sub-folders? Or it just a feature that hasn't been implement yet?
Or is there a recommended work-around to make
But then you want to do something more complicated and you have to learn another scripting language. I prefer JS when you already have a lot of libs and code in JS.
If you find a developer you don't want to ask him if he knows bash and ask him to learn it even if it's just the basics.
JS all the way =)
I use the shell for one liners. Don't wanna create a script file with bash.
Also, I tend to like automation a lot. A lot of these one liners could be integrated into a CI system and it would be better to use JS for it.
And if the jobs are doing something that other processes wanna know I can now use Hook.io to alert other processes. Everything is wired together to me.
Thousands of simple tasks won't be easy to handle in the end.
to run this file just use the command
Be sure to change
Also I agree with visionmedia, keeping functionality separate is the way to go... using mocha has been awesome so far, this is my workflow
I put all my tests/spec in a sub-directory ./test/* so for example
so while working I just run the current test file that I'm working on, like
this way your tests runs quicker cause it only runs what you need, what you are working on... so then before I commit I do a full test
But yeah I think the best way to be a more productive developer IS to learn bash/shell stuff... don't fight linux... it is everywhere :)
You guys are missing the awesome that a make file brings
This means that you can do
Flexibility is king. This wins over a
Never knew what makefiles were used for until I read this. Thought it was rather cool so I copy paste the example but couldn't get it to work. After looking through some examples I noticed some wrote $(shell somecommand). So I updated the example and it worked.
If anybody could explain why I had to use $(shell) that would be great.
@visionmedia Processing directories recursively would be great with
But it runs test in other order. And extension is explicitly set. Though it's not a big problem, I think it's just the way one expects to run all tests (including subdirs) when specifies
I'm trying to create a cross-platform compatible command line call that runs all tests within a given directory. The problem is, --recursive only applies to the /test folder. I'm placing tests alongside the file under test.
This glob approach works, but only to one level of depth:
I can list the directories that contain tests which are deeper, but that's obviously not very scalable.
It would be great if Mocha's recursive flag would apply to folders outside of /test.
Not sure if
it will only check files that are direct children of the test folder. Same behavior as without
@LukasBombach Two tweaks:
# this should work fine in bash $ mocha --require babel-register ./server/test/**/*.spec.js
# windows; this causes the globspec to be interpreted by the "glob" module mocha --require babel-register "./server/test/**/*.spec.js"
$ mocha --recursive --require babel-register ./server/test