-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running pnpm with Satellite in the repo breaks tests because of dependency issue #3191
Comments
I think we have to stop running tests globally, and start doing it per sub-project. Each project needs its own test setup vs. a giant set of tests, and turbo repo can figure out running them all. |
Yes, but the issue is the Search service is currently affected by the local Satellite, which in turn is affecting the tests. |
In a case where Satellite wasn't merged inside of Telescope, The Search service would be using the Satellite package (in this case v1.26.0). If we had updated Satellite and made a release (say 1.27.0) in this case, Search wouldn't be affected until we update Telescope to use v1.27.0. |
I wonder if this is related to pnpm, and how Jest is doing module resolution? |
Yeah, pnpm is definitely doing something. The "hack" works because it makes the |
I don't full understand this, but I see others discussing issues like this and talking about modifying the way that pnpm does its hoisting, see https://pnpm.io/npmrc#dependency-hoisting-settings. What I think is happening to you is that the packages are being hoisted into the top-level |
If the tests are breaking because we're using a local version of Satellite for Search, can we just force Search to use Satellite from the npm registry? That way it will only use v1.26.0 release tag I pulled this branch and changed the following in
to
I ran
|
If I also update
Perhaps we can't update ES and ES-mock in Satellite by itself but in root as well? |
Telescope is my first monorepo so I am not familiar with the term. I had thought that as a monorepo, changing anything in Satellite shouldn't have to change anything in the other parts of the repository (until we tell the services to use the new Satellite update). If I had made the same changes to the old Satellite (the one with its own repo) and everything works fine, then ideally, shouldn't it be working too? I don't think ElasticSearch and ElasticSearch mock is the problem in this issue. There are also some really weird things going on with jest configs that happens but I can not explain, and I have not fully explored outside of search and satellite tests. But I'm pretty sure is not really related to solving this current issue, and should be an issue on its own. moduleDirectories: ['<rootDir>/src/satellite/node_modules', 'node_modules'], If I took it out, then Satellite tests won't run, and it'll get the same issue the current search has where the test file is reading from the root To make things even weirder, you can try adding the same line to the Search jest.config.js moduleDirectories: ['<rootDir>/src/satellite/node_modules', 'node_modules'], Basically, telling Search tests to read from the Satellite |
Jest doing this module resolution with pnpm's flat |
Uh, I think the jest config is another issue that was just exposed by this issue. |
In tests or in general? That is, does Search do this when run normally, or only in Jest? |
I tested Search service locally. It fails on my branch. So in general and in tests. |
OK, excellent, thank you for testing. Very odd. |
What happened:
I am trying to update ElasticSearch to 8.1.0. for Satellite.
The idea is to get Satellite updated first, do a release, and then have the Telescope Services try out the new Satellite version.
I updated ES and ES-mock for Satellite in #3187, and the tests for Satellite pass.
However, Search tests are now not passing.
What should have happened:
Updating inside of Satellite shouldn't affect other Services.
How to reproduce it (as precise as possible):
Try out #3187
Anything else we need to know?:
@manekenpix and I spent a lot of time trying to figure this out.
There is a hack to get this working locally that I'd like to explain first.
The hack:
pnpm clear
to get rid of all thenode_modules
in the root and in all services. Ifpnpm clear
doesn't work then manually delete all thenode_modules
pnpm i
npm i
please note there's no beginningp
jest.config
take outmoduleDirectories: ['<rootDir>/src/satellite/node_modules', 'node_modules'],
pnpm test satellite
,pnpm test search
,pnpm test
, and everything should pass.The problem without using the hack is that
pnpm
tries to be very helpful when installing dependencies. After the merge of Satellite to Telescope, Search (as an example) inpnpm-lock.yaml
looks like thisIt seems that when running
pnpm install
,pnpm
links the Services that are using Satellite to the local Satellite, instead of the Satellite package innode_modules
So what's happening in the Search tests specifically now is that the test file is trying to use the ElasticSearch-mock that its using right now. But, the
client
in the folders outside of the test file is using the locally updated Satellite. This causes the current test fail because the old ES-mock and the new ElasticSearch aren't compatible. But since I was only updating Satellite, and haven't touched anything else in Telescope, this shouldn't be happening.This will not only affect Search, and should affect our tests anytime there will be major updates in Satellite in the future.
If we want to keep the idea of keeping Satellite as its own app, releasing updates, and then using the new versions in Telescope services, then we'll have to find a way to deal with this issue.
The text was updated successfully, but these errors were encountered: