[Feature Request] Separate run-time and test-time dependencies
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.9k
- Forks
- 121
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
We have a monolithic codebase which we're trying to modularise into engines, using Packwerk to define and enforce the dependencies between them.
Moving our app code into the engines is usually pretty straightforward, but the tests are a problem. In a lot of places, the model code works generically without reference to the types of input it gets, but the tests define the behaviour using concrete examples of inputs using classes from outside the engine. We work with non-technical domain experts to write these tests, and they work almost exclusively with concrete examples, so rewriting them with dummy classes isn't a long-term solution.
What I'd really like is to be able to define one set of dependencies for the app code in each engine, and have Packwerk enforce those for the code under engines/whatever/app; and another looser set of dependencies for the spec code, and have Packwerk enforce those for the code under engines/whatever/spec. That way, we could move our test files across unaltered. Ideally, I'd do this in a single package.yml file:
enforce-dependencies: true
dependencies:
- app
- engines/base
- engines/engine1
- spec
- engines/base
- engines/engine1
- engines/engine2
This could then be simplified using YAML anchors etc...
Hope that makes sense! Apologies if this is already possible and I've missed how to do it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the package.yml configuration and the engines/whatever/app and engines/whatever/spec paths described in the request. Trace how Packwerk currently reads dependencies and enforces them, then determine how separate app and spec dependency sets should be represented. Done means runtime and test code can use distinct dependency rules while existing test files remain usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100