serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Need cover with unit tests

Open floydspace opened this issue 4 years ago • 4 comments

I do not really feel comfortable without unit tests, especially when we getting more and more new contributions from the community, which is much appreciated. So I'd like to cover sensitive functionality like packaging with tests.

floydspace avatar Sep 18 '21 11:09 floydspace

I think if a comprehensive list of what needs to be covered (usecases/scenarios) is provided, it might make it easier for people to contribute to some unit tests?

As it stands I personally don't know what "packaging" should do exactly.

samchungy avatar Sep 29 '21 00:09 samchungy

I think you are making two very good points. To help contributors participate we could have a scenario list of typical situations that need to be tested (I have a few in mind).

And then, a simple document explaining how this plugin works could be of value too.

I wonder where this should live ? As MD in the repo ? In a GH wiki ?

olup avatar Sep 29 '21 05:09 olup

I started preparing a wiki page and realized that the most common scenarios are well defined in the readme. So we can take basic test cases from there. For instance, a case when no configuration is required would be tested like we're having correct default options passed to esbuild's mocked build function and that we are not running packing logic.

Anyway, I will try to describe each scenario in more detail in the wiki and describe some test cases in AAA format, like what are inputs, what we do, and what we expect.

@olup feel free to add your ideas in the wiki.

floydspace avatar Sep 29 '21 22:09 floydspace

I had a little think about this - maybe if we don't get unit test coverage we can at least setup some integration tests with snapshots. Anybody have a good idea on how we an achieve this? Maybe have some sample folders run against the npm run build version of this?

samchungy avatar Dec 06 '21 12:12 samchungy