MutinyWallet / mutiny-web-poc

Mutiny node frontend proof of concept
MIT License
6 stars 3 forks source link

Set up frontend testing #6

Open futurepaul opened 1 year ago

futurepaul commented 1 year ago

I'm creating an issue for this because I'm already down the rabbit hole and it's not going well. Typescript + jest + create react app + craco... a lot of shenanigans for something that should be straightforward.

Tried following this guide but it isn't working for me: https://dev.to/brandonwie/absolute-paths-in-cra-setting-using-craco-feat-typescript-and-ts-jest-2301

Basically, I use typescript path aliases like @compoenent to make imports cleaner. But jest / ts-jest needs to be informed of this because apparently it does its own module resolution.

I'm tempted to cut my losses and migrate the whole thing over to vite / vitest / vite pwa

TonyGiorgio commented 1 year ago

It's not surprising that it'll take more than a few hours to set up an existing project for tests properly. You're just going to have to spend some more time with it. Didn't we already move platforms originally because you ran into a roadblock with vite? There's an entire ecosystem of testing in the react world that you'll just have to bite the bullet and conform to. It's very common that codebase structure needs to change in order to best prioritize testing.

futurepaul commented 1 year ago

attempting to follow this guide but still get the same errors I got before https://dev.to/brandonwie/absolute-paths-in-cra-setting-using-craco-feat-typescript-and-ts-jest-2301

related ts-jest docs: https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping/

futurepaul commented 1 year ago

wip here MutinyWallet/mutiny-node#302 (not working yet, but progressing)