cloverfield-tools / cloverfield

A next generation JavaScript boilerplate scaffolding tool.
MIT License
142 stars 8 forks source link

Auto-scan for globally installed scaffolds, fixes #13 #16

Closed nkbt closed 9 years ago

nkbt commented 9 years ago

Additionally fixed repo url Removed Package Scaffold (moved to https://github.com/cloverfield-tools/cf-package)

ericelliott commented 9 years ago

Tests? =)

It looks good to me, but I want to see it exercised. =)

Can we fail build on poor coverage, too? That would be handy.

nkbt commented 9 years ago

We can. Need to setup Coveralls for that. Easy.

nkbt commented 9 years ago

I will add tests today. Need testing tools merged first #15

ericelliott commented 9 years ago

Add CircleCI to the boilerplate first, and port it in here so we can set up CI integration?

:grey_question:

nkbt commented 9 years ago

They are completely independent I reckon. So will do on both in parallel

ericelliott commented 9 years ago

:+1:

ericelliott commented 9 years ago

Status update for this and cf-package?

nkbt commented 9 years ago

Had pretty hard 2 days, so picked only low-hanging fruits. Will add CircleCI and basic tests today (after work) so we can merge these.

ericelliott commented 9 years ago

Sorry to hear that. No worries! =)

nkbt commented 9 years ago

Okay, that was actually very quick with CircleCI. I will put repo-specific config instead of Web UI config later. As well as some tests. As part of this PR.

ericelliott commented 9 years ago

Yay!

nkbt commented 9 years ago

Updated with CI, test coverage report and other checks.

ericelliott commented 9 years ago

Any movement on this?

nkbt commented 9 years ago

Not quite happy with tape testing. And also not sure if we need to unit-test code that consists of basically 100% side effects. Maybe some functional tests?

ericelliott commented 9 years ago

Yes. There should be unit tests for any exported pure functions, and functional tests for api with side effects. Don't mock the filesystem to test a thin wrapper around fs, please. ;)

nkbt commented 9 years ago

Clear.

ericelliott commented 9 years ago

:guitar: :notes:

nkbt commented 9 years ago

@ericelliott added tests for find-scaffolds. Found one bug lol =).

Still don't like tape. too much boilerplate...

nkbt commented 9 years ago

I could not find any decent examples of how people use tape to write fairly complex and well structured tests. Do you have any by chance?

nkbt commented 9 years ago

Do you think we need to test cloverfield? It is kind of side-effects only

troutowicz commented 9 years ago

Still don't like tape. too much boilerplate...

There is boilerplate in tape? Tests are plain JS functions.

nkbt commented 9 years ago

Tests are plain JS functions.

Exactly. So you must build all things around it. Like before/after and so on. Cleaning up spies, restoring stubs.

I am still struggling with mocking dependencies as well. Will try babel-rewire again and pray it will work with coverage (last time I tried - it broke coverage generator).

troutowicz commented 9 years ago

Yeah that's true, the before/after does add some boilerplate. But it's better than the alternative... having repeated code.

Anything in particular you need a hand with?

nkbt commented 9 years ago

Alternatives are beforeEach/afterEach in jasmine and jasmine spies which do all that dirty work for you. Not agitating or arguing though. I'm fine with tape, just ranting.

What would help:

I could not find any decent examples of how people use tape to write fairly complex and well structured tests.

I am still struggling with mocking dependencies

If there are good working solutions that do not break coverage and play nicely with es6/7 - happy not to spend time on that and embrace it in my code.

troutowicz commented 9 years ago

OK. I always used rewire and sinon for dependency mocking, but I wasn't checking coverage. I can try to take a look at this in the next few days.

nkbt commented 9 years ago

Rewire is nice but it is broken for ES6. There is babel-rewire, but when I tried using it on frontend code I could not finish the build/test/coverage. That is most likely due to rewire "adding" more stuff in the code then it was originally there. I've debugged karma/webpack/babel-rewire/isparta and came to conclusion it gets too messy and switched back to inject-loader for webpack, which works perfectly.

But it is not a frontend code anymore here. And node/backend infrastructure is way behind the progress.

ericelliott commented 9 years ago

This project should have minimal unit tests, and more functional tests. Why? Because it is mostly a tool for working with the filesystem and the network.

My guess is that your logic and your side-effects are too tightly coupled to be tested independently, and that's a code smell.

This post might help clarify: Why I Use Tape Instead of Mocha and So Should You.

ericelliott commented 9 years ago

"Separation: Logic is thought. Effects are action. Therefore the wise think before acting, and act only when the thinking is done." ~ The Dao of Immutability

nkbt commented 9 years ago

Thanks for the article.

  1. find-scaffolds is actually quite testable. So it is now covered. No functional tests.
  2. cf can be split more, so I will push CLI side-effects "to the edge" and have those bits of logic pure.
nkbt commented 9 years ago

find-scaffolds itself could be updated as well, so it would be possible to avoid mocking at all for it. I will look at that as well. Should be quite easy.

ericelliott commented 9 years ago

find-scaffolds is actually quite testable. So it is now covered. No functional tests.

:+1:

cf can be split more, so I will push CLI side-effects "to the edge" and have those bits of logic pure.

Sounds good. =)

nkbt commented 9 years ago

Updated all things

ericelliott commented 9 years ago

Looking good. Just a test description nitpick before merge. =)

nkbt commented 9 years ago

Phew, will fix it asap, riding to work now....

ericelliott commented 9 years ago

=)

nkbt commented 9 years ago

Updated

nkbt commented 9 years ago

\o/