gatsby-plugin-netlify-cache
gatsby-plugin-netlify-cache copied to clipboard
We need tests, but how?
I guess we should add tests, even when this is a very small plugin.
But, the magic is mostly happening on Netlify, so, any suggestions how and what we test?
We could stupidly check if nothing happens on dev, cache gets actually persisted and so on. But is this the right way? I am not sure.
Ideas & PR's are very welcome :)
Ps.: Please use jest if you start hacking tests, it is just the best 😅
So that's just an idea, don't know if that would even work:
Github can trigger builds for Netlify on a PR. Netlify then builds the site and gives feedback in the PR. Could we somehow test if the build log of a second build on that PR branch contains the "keywords" that Netlify actually used the cache?
That might be an option. We might also rerun the build to check if it actually did speed up 🤔
Yeah, with heavy image use which then would be cached. That's the only idea I came up with 🤔
After #15 these are going to be needed more than ever. I am sure @fool at Netlify would be glad to make sure there is a good test path or suggestion of what is needed.
It's true. I guess the failure mode I saw in #15 would be at least possible to detect: is the number of files in cache growing faster than the number of NEW files committed? I don't have any easy way of "looking at" your cache offline (vs during a build) so the test would have to run inside our CI but that seems like a sane place to put it anyway ;)
Can't help much with the tests but maybe using the netlify build-image locally could help? https://github.com/netlify/build-image#testing-locally-with-cache