Anyone having this error? running `sst test`.
# sst
a
Anyone having this error? running
sst test
.
@Frank this happens to me with default config from SST.
f
Hey @Adrián Mouly, you are using yarn workspace, and SST is one of the packages in the workspace right?
a
Yes sir.
And also, using typescript.
f
@Adrián Mouly I created a gh repo with a similar structure.
The test ran fine for me. Can you see what might be the difference? https://github.com/fwang/sst-triage-ts-jest
a
Hummmmm, ok let me check, thank you for taking the time.
@Frank I’ve checked this but… why your SST is on
serviceA
? shouldn’t be at the root?
So if you have 10 services, you are going to have 10
sst
files?
f
Sorry I misunderstood what you mean. I thought the SST app is one of the packages.
So the
sst.json
is at the root. Are you also running
sst test
from the foot?
a
@Frank yes sir.
I’m following the monorepo model, I think there is a repo with that.
f
I just updated the project structure https://github.com/fwang/sst-triage-ts-jest
sst test
should pickup both the infrastructure tests in
test/
and lambda function tests in
packages/serviceA/
a
Thank you sir, going to check it.
Foudn the problem.
Somehow having the
/frontend
app makes that error.
For some reason my frontend project is adding that dependency.
f
I see. I think it might make sense to exclude the frontend tests from the
npm test
script. Maybe see if setting the scope for the test script helps:
Copy code
"test": "lerna run prepare && lerna run test --stream --scope='{serviceA,serviceB}'"
a
Interesting, didn’t thought about using lerna that way.
Not sure how can include the SST tests too.
Because those doesn’t have scope, right?
f
hmm.. that’s a good point
a
Interesting.
Maybe we need to define a workspace for SST code?
Or that is not a good idea?
f
I’m thinking about that too. Maybe give it a try.
a
Today I have
lib
and
test
on the root.
f
Let me cc @thdxr on this.. he’s given some thoughts on the project structure side of things
Yeah, I wonder if it makes sense to move test inside lib?
a
Yeah he has different thoughts about folder structure, I been trying to find the right way.
Yeah possibly, inside
lib
would make more sense.
Can’t find which should be the correct structure.
Because I have
frontend
,
src
,
lib
and
test
on the root.
But this doesn’t make much sense.
frontend
also has
src
inside.
Maybe I have to create 3 main folders with children:
Copy code
- frontend
  - src
  - test
- backend
  - src
  - test
- infrastructure
  - src
  - test
I wonder how much stuff I’m going to break from SST-CLI if I do this, hahaha.
Is there a way to tell
sst cli
where to look for
index.ts
?
Ah, found it!
Copy code
"main": "sst/index.ts"
Thanks to @thdxr who created that starter project.
t
Starter isn't done yet haha I'm still changing my mind on decisions in it
a
Hahaa.
I know.
Can’t figure out the proper way.
I’m testing this model now:
Copy code
- frontend
  - src
  - test
- backend
  - src
    - packages
      - pkg1
      - pkg2
    - services
      - srv1
      - srv2
  - test
- infrastructure
  - src
  - test
Also @thdxr didn’t use lerna 😞