tp / tsaga

Typesafe and lightweight way to write Redux-connected functions with asynchronous side-effects that are easily testable.
Apache License 2.0
8 stars 1 forks source link

Export test helpers not from the main module #56

Closed HenriBeck closed 5 years ago

HenriBeck commented 5 years ago

I think it would be good to split out the test helpers from the main module export.

We could export them from tsaga/testing for example which will make it more clear for what a call is being used for example.

HenriBeck commented 5 years ago

Another benefit would be not to bundle the test code with the application code. Currently, because we are not using ESM, the testing code also gets bundled in the final bundle.

tp commented 5 years ago

I like the explicit tsaga/testing.

Wouldn't have thought bundling is an issue though, because even if one uses a simple bundler that only imports actually files it should be able to "go through" the index and find the implementation files, but leave the testing exports unregarded.

HenriBeck commented 5 years ago

Because we bundle our code to CJS, it's not possible to remove unused files/functions because exports can have side effects.

I think there is an option to set side effects to false inside the package.json to allow stripping unused files, but I would instead start bundling ESM.