Running `sst test --testPathPattern=test/` for my ...
# sst
a
Running
sst test --testPathPattern=test/
for my SST stacks tests… any ideas what could be this issue?
f
They seem to suggest
jest —clearCache
in this thread https://github.com/kulshekhar/ts-jest/issues/2612
give that a try?
a
Going to try it.
Also, my
package.json
doesn’t have any jest dependency, those are provided by sst?
f
yeah
npx jest -clearCache
should work
a
Copy code
● Validation Error:

  Preset ts-jest not found.

  Configuration Documentation:
  <https://jestjs.io/docs/configuration.html>
I got this error before, and installed `ts-jest`… but why is required? SST is not installing it?
s
I’m getting this error now too, when I run
yarn test
. didn’t used to happen
a
Yeah.
Not sure what is wrong.
I don’t have any Test framework setup.
😞
Let me know if you find the root cause.
s
maybe something internal in SST. I didn’t change anything w/ regard to my test setup
a
Yeah me neither.
But never worked to me.
Hahaha.
It’s just now that I want to setup it.
@thdxr help ⚠️
t
Hey afk right now
Can you check if node modules has ts-jest
I've never used sst test I set it up on my own
a
Copy code
yarn why ts-jest
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "ts-jest"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "ts-jest@26.5.6"
info Reasons this module exists
   - "_project_#@serverless-stack#cli" depends on it
   - Hoisted from "_project_#@serverless-stack#cli#ts-jest"
   - Hoisted from "_project_#@serverless-stack#resources#ts-jest"
✨  Done in 1.39s.
I don’t see it on my node-modules.
s
node_modules/ts-jest
doesn’t exist. my
yarn why
shows the same as Adrian’s
Copy code
├─ @serverless-stack/cli@npm:0.40.5
│  └─ ts-jest@npm:26.5.6 [a593f] (via npm:^26.1.4 [a593f])
│
└─ @serverless-stack/resources@npm:0.40.5
   └─ ts-jest@npm:26.5.6 [a593f] (via npm:^26.1.4 [a593f])
a
So why is not installing it?
If it’s a dependency from SST.
s
it’s not in SST’s package.json though
I think I’ll just install Jest myself like Dax did. better to have more control over it anyway. just
yarn add -D jest @types/jest ts-jest typescript
and then
yarn ts-jest config:init
and you’re all set 👌
a
I dont want to deal with that.
I want to use it out of the box.
😞
s
@thdxr - curious about your Jest setup when you have a minute later. every time I save a file, it re-runs all tests even if nothing was changed. I’m using
--watch
🤔