Question regarding testing.. `sst test` has been ...
# sst
a
Question regarding testing..
sst test
has been removed, right? How should I execute my existing tests? also, should I migrate to Vitest?
t
I would definitely suggest migrating to vitest, we just did it for the sst codebase and the speedup is insane
that said you don't need to do this, you can install jest + follow the steps on their site to set it up
all
sst test
really did was run jest for you
a
Ok, going to take a look.
@thdxr is there examples on how to use vitest?
I mean, with SST.
I configured fine, but want to write some test now.
t
should be identical to jest only different is you have to
import { test, expect, ..etc} from "vitest"
a
Oh, ok.
Can I set the stage too?
Because I want to set an stage to use, that way can read the env-vars.
t
I actually don't write stack tests so I'm not as familiar with how people write tests
but I believe you can when initializing
App
a
Good point.
Ok, I did that but still not reading my env-vars.
So will need to check some examples.
f
Hey @Adrián Mouly, I added an example for running stacks tests here https://github.com/serverless-stack/serverless-stack/tree/master/examples/stack-tests
It shows how to create an app object in a specific stage (ie. “prod”), and loading environment variables from
.env
files.
Let me know if this makes sense.
a
Cool, going to check it.
l
Ok, I totally fell in love with
vitest
, thanks for the change team! 😄
a
Thank you very much @Frank, this example worked for me.