inline-test-ppx
inline-test-ppx copied to clipboard
Async import generated by inline-test-ppx doesn't work with rescript-test
The generated test import files use an async import like so:
import("../../src/myfile.mjs").catch(e => {
if (e.code !== "ERR_MODULE_NOT_FOUND") reject(e)
});
but that breaks rescript-test, it will always find 0 tests because the import hasn't resolved yet when it tries to run them
changing it to a synchronous import makes it work correctly
import "../../src/myfile.mjs"
Notice though that when it's synchronous it'll crash when you end up moving a file containing tests. Do you have any ideas how to work around it?
I'm just getting started with rescript, I'm not sure how to best work around this. Moving a file containing tests doesn't happen very often does it? A note in the docs along the lines of "if you move a file containing tests you need to clean/rebuild" might be good enough?
I don't think it's a trade off we're willing to accept.
I suggest to fix it in rescript test. Jest and zora work well with this ppx.
I think rescript-test does some name mangling when building out of source, we'll investigate how to make it compatible with inline-test-ppx.
@tsnobip Do you think it's that? Notice the change @evelant had to make to make the ppx work 🤔
yeah @wokalski I guess this is something else.