Raathigesh / majestic

⚡ Zero config GUI for Jest
MIT License
7.49k stars 173 forks source link

root directory must match OS specification #199

Open gregveres opened 4 years ago

gregveres commented 4 years ago

Is this a bug report or a feature request?

This is a bug report. I am on windows, but I was trying to follow your instructions for setting up the development environment. I went into cli.ts and I set my root to a unix type path (not wanting to have to escape every backslash in the path). Majestic found the tests and could run the tests, but the tree didn't show anything. Instead it showed my root path as the top level node and wouldn't let it expand.

I poked around the code and found that in project.ts, I could use path.normalize() on the root to convert it to the specification of the OS and then everything would work properly after that.

I will create a PR for this and you can decide if you want to accept it or not. Normalize will do nothing to the path if a proper path was specified. Normalize is really for getting rid of '..' embedded in the path.

With the code the way that it is, a single user on a single machine will be fine. But for a team environment where some users on Macs and some on Windows machines, they will be a little screwed because they can't check in their majestic configuration. But with this change, those people could check in a unix configuration and then the majestic code base would convert to the appropriate platform at run time through the normalize call.

Version Info

Reproduction Repo

On windows, set your root directory to the proper directory but use a unix style path. Then run from another directory to see the behaviour I mentioned above.