is `sst test` in a working state? when I run it, i...
# help
s
is
sst test
in a working state? when I run it, it just prints “Preparing your SST app” and seems to stop there
oh. even installing jest myself and running it hangs. 😕 jest doesn’t like SST for some reason
man. this might be a moot point anyway.. I might stop using jest. even in projects where it works, it’s slllooowwww. over 10 seconds to just test a simple pattern matching function. should be under 1 second
d
chances are good that most of the time is spent transpiling the code. It should be cached on a second run, or you can do incremental TS builds. I havent found anything as fast as Jest in my own experience. Everything I said assumes you are using TS.
s
how long should it take to transpile though? we’re talking a really small test, testing some really simple & short code.
d
not sure, it might need some help ignoring some stuff if it is really that simple (tsconfig). For comparison, I just ran 120 tests on a large library that contains virtual database bootups and it took 13 seconds.
m
I'm watching https://vitest.dev/ with great interest.
s
@Matt Morgan ooh, cool! nice to run into another Vue dev here 😄
m
No, actually not, but I like vite a lot.
s
oh right.. Vite is not strictly Vue
m
Nothing against Vue, but the product I work on had a bunch of react already.
s
makes sense
f
Try using
jest
directly for now. Currently
sst test
wraps around
jest
but doesn’t provide much benefit. We are re-thinking the test strategy for SST apps.
t
Use esbuild runner with jest
Huge speed improvements
s
@Frank I tried that.. even just running
jest
hangs. I’ll have to try in a fresh project to see what happens. @thdxr how do I go about setting that up?
s
@thdxr hangs completely 😞 this is baffling.
t
strange
I hate jest so much
s
haha
it’s overrated
I bookmarked an article on setting up Mocha + Chai + TypeScript. I’ll go through that later
m
jest is a nice API in many ways, but the internals give you fits. That's why I'm putting my hopes on vitest.
t
I've been meaning to setup vitest
I couldn't tell immediately though how to set it up for backend
m
Also eyes on https://kdy1.dev/posts/2022/1/tsc-go. This kind of stuff should help a lot.
I have a 300k loc TypeScript project and the tests are painfully slow with coverage.
t
Yeah was excited to see that post this morning. I've been following his rust attempt and it seemed to have stalled
d
if you hate Jest, you will really hate Mocha, lol. I have no argument with any of the above, though, I have gotten very deep into testing and still cant explain a bunch of the failures.
s
I mean, jest doesn’t even run for me. so.. literally any testing framework will be a step up 😄