flarelabs-net / vite-environment-providers

1 stars 0 forks source link

TODO: implement more fine grained tests in the `cloudflare-dev-module-resolution` fixture #12

Closed dario-piotrowicz closed 1 week ago

dario-piotrowicz commented 1 week ago

In the cloudflare-dev-module-resolution we have tests that look like this:

https://github.com/flarelabs-net/vite-environment-providers/blob/3576bcebfe9538a9a24922c001f2fbcdf69926f2/fixtures/cloudflare-dev-module-resolution/index.test.ts#L24-L33

These are valuable as they make sure that we can handle/resolve real world modules appropriately, but they are not really helpful in testing fine/grained specific issues (e.g. the discord-api-types/v10 package doesn't have any special meaning to us, but the tests can make it sound like it does).

We should ideally include more fine grained tests as well (e.g. testing if we can import json files, testing if we can import modules which are imported without a file extension, etc...).

I briefly started exploring this but I didn't have much luck since, when I tried adding auxiliary packages in our monorepo they were not being resolved as external by vite, thus not involving our module resolution logic.

But there should be a way to implement such fine grained tests, for example by actually publishing to npm an auxiliary package (packages) to use, or maybe vite provides a way to treat modules as external (maybe with the external option?)