Skip to content
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

Suggestion about a test folder. #3

Open
alesch opened this issue Aug 13, 2015 · 5 comments
Open

Suggestion about a test folder. #3

alesch opened this issue Aug 13, 2015 · 5 comments

Comments

@alesch
Copy link

alesch commented Aug 13, 2015

Instead of having my code inside lib, I create two folders, src and test.
I can then put the tests inside the package.

@coopermaruyama
Copy link
Owner

Good idea. I do something like this for personal use, however I use sanjo:jasmine which isn't the default, so I'll need to figure something out that's ideal for all (or most) testing methods.

Ideally I would like to add a CLI tool to add tests which would let you add tests inside each module, (e.g. packages/my-modules/tests/ like you do and symlink it as necessary to work with jasmine, tinytest, mocha, etc. But this would mean evolving the repo from an 'example' to a 'tool' - another thing I need to consider.

I know meteor reserves the 'tests' directory in app root for tests - is this also true for packages? I've always had to symlink into tests/jasmine to get things working right..

@alesch
Copy link
Author

alesch commented Aug 18, 2015

I don't think you need the symlinks. With this setup you run your tests with meteor --test-packages, and all frameworks support this. This support is actually better than the one for tests at the app level.

This is relevant even for end-to-end tests, if they are possible to test.

@alesch alesch closed this as completed Aug 18, 2015
@coopermaruyama
Copy link
Owner

Alright so I tried testing within packages using this structure a little bit and I noticed that my helpers in tests/jasmine were not available to me inside my modules, which makes sense since it's isolating the package.

To keep in line with the purpose of this package I would like to keep this open until either I or someone else can add a utility package which you would api.use() when testing to get access to a bunch of tools/workflows specifically for working with large codebases. Ideally this would also introduce an easy way of getting the fixtures you need without having to make too many of them manually. I haven't really seen a big meteor project yet which consistently incorporates TDD (Telescope only has like 3 files in tests/jasmine) so I don't know what would be 'useful' for large applications.

@alesch
Copy link
Author

alesch commented Aug 23, 2015

Maybe having a test-lib package with your test helpers, that you can api.use()?
Setting debugOnly: true in package.js would prevent it being packaged for production.
See: https://velocity.readme.io/docs/data-fixtures.

@alesch alesch reopened this Aug 23, 2015
@coopermaruyama
Copy link
Owner

That's exactly what I had in mind. I'm going to play with this for a bit,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants