drewdeponte/alt

Monorepo support

Opened this issue · 9 comments

Fetz commented

When using in a monorepo (example Lerna), if you run alt from root of the repo, alt is not working.
You need to go the first to one of the package folder

// repo tree example

├── package.json (private module)
├── packages/
│   ├── module1/
│   │   ├── package.json (module)
│   │   ├── src/
│   │   ├── tests/
│   ├── module2/
│   │   ├── package.json (module)
│   │   ├── src/
│   │   ├── tests/

Is there a public repo I can test against and see exactly what you are seeing @Fetz?

@Fetz also can you more precisely define what "not working" means?

Fetz commented

Is there a public repo I can test against and see exactly what you are seeing?
No sadly not

also can you more precisely define what "not working" means?
Doesn't find the alternate file, since the test file isn't in the expected folder.

If I understand correctly, how alt works, in a folder structure like this:

root of the project (git root)
.
├──packages/
│   ├── module1/
│   │   ├── src/
│   │   │   ├── file1.js

alt should try to look for the alt test here:

root of the project (git root)
.
├──test/
│   ├── packages/
│   │   ├── module1/
│   │   │   ├── src/
│   │   │   │   ├── file1.spec.js

but the tests are in this folder:

root of the project (git root)
.
├──packages/
│   ├── module1/
│   │   ├── tests/
│   │   │   ├── file1.spec.js

As well, I found as well that with new version of jest it supports tests files like this:

├──packages/
│   ├── file1.js
│   ├── __tests__ /
│   │   ├── file1.spec.js
Fetz commented

The only way I managed to handle all those variations from projects, was by using a configuration file for example using projectionist

@Fetz I created a branch with a potential fix in it for this. Can you grab the "monorepo_support_22" branch and build it locally and use the appropriate build in the targets folder to test out if it is working correctly now?

If you have any questions or need guidance just hit me up.

@Fetz bump ^

Fetz commented

@drewdeponte I will check today and I will let you know

@Fetz did you ever get around to testing this?

I just released a new major version bump of this, v4.0.0 which I believe should help this scenario.