-
Notifications
You must be signed in to change notification settings - Fork 43
Refactor test suite to Jest (+watch +coverage) #437
Refactor test suite to Jest (+watch +coverage) #437
Conversation
…suite Conflicts: package.json
…ig as env + remove unnecessary globals.
Followon from #322 : my first thought is this: https://youtrack.jetbrains.com/issue/WEB-14979 <- jest does not have direct webstorm support yet. :| But that's really just ide-sugar anyway. As long as there is a cli entry point and file saving triggers watch mode, then we're good regardless of explicit support. And if debugging via devtools works, then that solves the other use case. I will try this one out in earnest later in the day. |
They use |
https://youtu.be/1cfA87h_1hI Notice that |
…devtool_for_prod Set source-map as default production devtool
Script to update package version
Bump gluestick-shared to 0.4.22
This looks really cool! Looks like there are some issues in the build: https://travis-ci.org/TrueCar/gluestick/builds/193784640#L387 |
The tests are broken specifically when |
All test seem to Edit 1: Ok, I found that the test that makes Travis to fail is The other thing that concerns me is that all these tests are actually hitting the disk and creating/removing files. Probably, we want unit tests to mock this behaviour. See the exact example with Edit 2: Ok I have the build passing: https://travis-ci.org/TrueCar/gluestick/builds/194489121 The problem is that I had to run it manually since it looks like that PRs to |
I updated .travis.yml so it should now include the |
Yeah, since a major part of the CLI is creating files, it does write and read from disk during tests. I'm sure we could mock this but it might get tricky to validate the CLI is actually doing what it should. We are totally open to any suggestions here |
So build is green :). About hitting the disk, I think that for now is fine. Maybe in the future we want to try something but it does not feel as a bottleneck right now. I think this PR is ready as it is @toddw. |
works great! Thanks @ferrannp I was not able to get Chrome inspector to work yet but that's a different issue. |
Related to #406
test
folder are now using Jest and they only depend on it (nosinon
, noexpect
). There is a configuration inpackage.json
to tell Jest only run tests insidetest
folder--watch
mode is working (see gif below)npm run test-coverage
will create html page intocoverage
folder (so it also solves Cover reports no longer being generated in gluestick (resolve with Jest) #345)This is a pull request to get familiar also with Jest and play with it (specially with the
--watch
mode). If we are happy with it, we could also introduce Jest to the generated app with gluestick so we can get rid ofistambul
(solving #333),mocha
,karma
,sinon
andexpect
(maybe even more if we needed specialbabel
deps for it).Watch mode
Debugging