Hacker News new | ask | show | jobs
by arvindrajnaidu 1596 days ago
I agree. Tests for example used to be in a separate folder mirroring the code folder structure. I have moved away from that to put it right next to the file.

Random thought: Can the IDE recommend next file to work on - “people who worked with this file, also worked on”. The real problem is not where we keep it, it’s how quickly we can get to it.

2 comments

You see, this is a design that's taken hold of a lot of codebases, and I don't think it works. I see a lot of projects with big folders mixing top level exports, implementation files, tests, test utils, fixtures and the like.

I'd much rather see the 'mirrored' approach.

> Random thought: Can the IDE recommend next file to work on

I'm _sure_ I've seen something like this in IntelliJ.

EDIT: I did! It's in the changes tab > the eye icon > 'show files related to active changelist'. It then sometimes will make suggestions based on project history.

Tests that involve complicated setup or are otherwise bigger than "unit" tests probably don't make sense to keep in the source tree.

But it's a nice idea to keep unit tests specifically alongside the "units" of code that they test.