How do you configure tests with the Solito monorepo example? #243
Replies: 7 comments 3 replies
-
Hey, I’m actually not sure, but this would be useful! Could you check the showtime repo maybe? |
Beta Was this translation helpful? Give feedback.
-
Hey, so I just set up Jest in a solito app pretty easily by following their docs. I installed the
And then I put a module.exports = function (api) {
api.cache(true)
return {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
}
} And now it works with |
Beta Was this translation helpful? Give feedback.
-
Maybe you could try adding a module.exports = function (api) {
api.cache(true)
return {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
},
"plugins": [
["module-resolver", {
"root": ["./"],
"alias": {
"app/*": "./packages/app/*"
}
}]
]
} |
Beta Was this translation helpful? Give feedback.
-
Thanks @nandorojo I did consider setting jest up at the root but what if you have an app that needs/wants a different jest config. Example Also I did mess with module resolver but not that exact pattern so let me give that a shot. Thanks for looking at this! |
Beta Was this translation helpful? Give feedback.
-
I am not finding it straightforward to follow. After installing Solito (using the template with nativewind) I installed Zustand, and now I wanted to install Jest to do TDD. I installed as dev dependencies in the package.json in the root:
I also altered the "scripts" section of the file and added a "jest" section, so now it looks like this:
Additionally, I have added the babel.config.js file in the root as well with the following contents:
And I created this simple test to check if things were working:
Then I run the test with
I have also tried following Expo's official documentation (which didn't work straight away either, I had to modify many things) and I got it to a point where it looked like it is working. But I am missing something because I get an error that I can't figure out from where it comes from : The test that I am running seems very straightforward to me…
|
Beta Was this translation helpful? Give feedback.
-
@mikefisher84 @guplem, Hi, did you find any working solution. I am also struggling to set up testing in a solito monorepo but no luck. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks for making this great monorepo starter. I've been trying to configure jest tests and for the life of me I can't seem to get it working.
I would like to have some tests in
packages/app
but also some tests inapps/expo
to verify they're working. When I configure jest inpackages/app
it works fine. However when I write tests in apps/expo that use the modules frompackages/app
it always fails with this error:In the test if I write
jest.mock('app", ()=>{})
the test passes just fine.I'm assuming this is because jest isn't correctly transpiling the code from the other packages but after searching high and low I can't seem to find a solution for this.
Would love to see a solito example with jest testing configured.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions