Does anyone now how to configure Babel for an app ...
# help
d
Does anyone now how to configure Babel for an app based on the sample app? I’ve fully borked my testing setup for my example app. When I run
npm run test
at the project root i get
Copy code
cannot find module babel-jest
with a project path pointing to:
Copy code
node_modules/@serverless-stack/cli/scripts/util/babelJestTransform.js
if I install babel and drop in a config
Copy code
babelJest.createTransformer is not a function
also in the CLI. How i got here was I added a test in the react app, then deploy’s broke on
Seed.run
see the previous thread here. At that time, at least the tests worked for the App, just not the react app. https://serverless-stack.slack.com/archives/C01JG3B20RY/p1633213092119300
f
Hey @Devin, let me loop in @thdxr and see if he can spot anything.
d
@thdxr Any ideas around this? I’m happy to provide additional info.
t
Hm I'm not super familiar with babel - been avoiding it for a few years now
d
lol. I relate to that for sure.
t
I'm reworking how we do jest this week
it'll make jest behave less weird when in sst
d
Yeah. It’s a bummer because you can’t add a test to the react app without breaking the deploy through Seed
t
I tend to not run tests at the project root
because the testing configuration can look so different on backend vs frontend. I actually don't even use
sst test
personally, just call into jest directly
d
I switched over to next.js kinda hoping that it was more of a build issue but the problem persists there
so in package.json you just run a different test command?
t
If my folder structure is
Copy code
sst.json
package.json
backend/
frontend/
I tend to have a package.json in both backend + frontend with a specific test command in each
No frontend there but you can imagine another folder like backend called frontend
d
I see. My setup is basically the tutorial app + NextJs.