-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for mocha-given doesn't run #4
Conversation
Don't know what the error is about. When I go to travis, it seems to be passing... |
Try |
@tandrewnichols At what root folder? The project |
Another easy way is to symlink the mocha-given lib into the node_modules folder. I'll post this ASAP and add a script to the package.json And mocha given should not have any dependencies next to coffee-script. Mocha itself is a peer dependency. To test mocha-given you'll have to manually install it. The purpose is that used in a project, mocha-given should not add overhead to the project - but it makes it harder to jump on developing mocha-given. I'll also add a short description to the readme to clarify things. |
@rendro Well technically I didn't add it as a dependency but as a devDependency which allows mocha-given to be tested independent of the global environment. If mocha 2.0.0 were to be released with breaking changes, the local version of mocha when developing mocha-given would still be the one specified in package.json and it coul be increased at the projects own pace. That being said I think that the most important thing is that the tests should always run correctly when executing |
Mocha is references as a peer dependency to avoid problems once mocha releases a newer version with breaking changes. Furthermore mocha-given itself should only be added as a devDependency because tests are only for development and not production. Now, after following the instructions in the readme, you can run the tests with |
Ok, I guess that works. Just note that the guy that wrote the article you linked to also created Chai as pormised. That lib has chai as a peer dependency and as a dev dependency. It also has a bunch of dev dependencies and no regular dependencies. Installing chai-as-promised only installs one other lib and that is the peer dependency. So adding mocha as a devDependency does not add overhead to users of mocha-given. |
Thanks! The problem again is how to enable mocha to load mocha-given as a dependency when it is the current directory, because mocha looks for mocha-given in the node_modules folder but not in the root directory. Do you know a good article on how the dependency installing works with npm in detail? When are devDependencies being loaded and when not and stuff like that? |
Only place I have read about it is in the docs (you need to search for the headline devDependencies). But basically, devDependencies are only installed when you work with your lib. They are not installed as sub dependencies when other people depend on your package. And if mocha-given is not in the node_modules folder you can load it manually as I did in |
Yes, I know, but I don't like the idea to load all the tests programmatically if it also works with the symlink solution. It is closer to the actual use. So we should add mocha as a devDependency as well to facilitate the development process! |
It is of course up to you. Adding mocha as a devDependency will get rid of the step you have in your readme right now saying
I am not sure how the symlink will work across different operating systems. Not that I am a big fan of windows though... |
Yeah, it won't work on windows, thats true. There is a native npm link operation that links the current module into the global node_modues folder (I guess it works on win), but when I tried it out, mocha again could not resolve the UI :( |
@TheLudd I misunderstood what you were saying I think. But it looks like you've resolved it anyway. |
I tried cloning the
mocha-given
repo and run the tests but it didn't work for me. I get this error:Here is a fix for it. I have create a test runner acording to the instructions in the readme file for
mocha-given
. I changed thenpm test
command to use the test runner. I also addedmocha
as a local dependency since this will make the tests independent of global installs on the machine that runs them.