Skip to content

Conversation

@adurymanov
Copy link
Contributor

Summary

Introduces {{target}} and {{testTarget}} placeholders in the test_target_path configuration, allowing dynamic path resolution across multiple targets.
This change is fully backward-compatible.

Motivation

Previously, multi-target projects required duplicating configuration entries for each target.
With this update, a single flexible pattern can be used instead.

Before:

# Repeated for each target
test_target_path: "${PROJECT_DIR}/Features/FeatureA/Tests"

After:

# One pattern for all targets
test_target_path: "${PROJECT_DIR}/Features/{{target}}/Tests"

Changes

  • Added ConfigPathResolver utility with a simplified public API
  • Integrated template resolution into GeneratedTestsOptions
  • Added 18 new unit tests and 9 integration tests (57 total, all passing)
  • Updated related documentation

Examples

# Dynamic per-target paths (NEW)
test_target_path: "${PROJECT_DIR}/{{target}}/Tests"
# → resolves to: ${PROJECT_DIR}/MyApp/Tests

# Both placeholders (NEW)
test_target_path: "{{target}}/Tests/{{testTarget}}"

# No placeholders (still works)
test_target_path: "${PROJECT_DIR}/Tests"

# Absolute paths (still work)
test_target_path: "/Users/dev/Tests"

Benefits

  • Eliminates path duplication in multi-target setups
  • Works seamlessly in monorepos
  • 100% backward-compatible

Testing

make test   # 57/57 tests passing
make build  # Build succeeds

All existing path resolution scenarios (absolute, relative, test target name) remain valid and verified.


Also includes:

  • Added .serena/ to .gitignore

- Add ConfigPathResolver utility with clean parameter interface
- Support {{target}} and {{testTarget}} placeholders
- Apply to test_target_path configuration only
- Comprehensive unit tests (18 test cases) and integration tests
- Backward compatible with existing configurations

Useful for multi-target projects and monorepos.

Also: Add .serena/ to .gitignore
@BarredEwe
Copy link
Owner

@adurymanov Hi! Thanks for improving Prefire. Great idea!
I tried it locally and ran the tests - everything works.

I only have one request: please use the names ${TARGET} and ${TEST_TARGET}. Also, please use the parameter substitution that’s already implemented in the project (file: ConfigDecoder.swift).

Will you be able to do this ☺️?

@adurymanov adurymanov force-pushed the feat/config-template-parameters branch from 4fd50b1 to d1e4389 Compare January 3, 2026 16:22
adurymanov and others added 4 commits January 3, 2026 17:25
- Add OptionsResolver for shared path/template resolution
- Create CLITestsOptions and CLIPlaybookOptions structs for raw CLI input
- Refactor GeneratedTestsOptions and GeneratedPlaybookOptions with factory methods
- Move ConfigPathResolver.resolve() call to factory after CLI+config merge
- Fix variable shadowing (config -> loadedConfig)
- Change options properties from var to let (immutable)
- Update tests to use new factory pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@adurymanov adurymanov force-pushed the feat/config-template-parameters branch from d1e4389 to 7c897d2 Compare January 3, 2026 16:28
@adurymanov
Copy link
Contributor Author

@BarredEwe I’ve renamed the variable placeholders to ${TARGET} and ${TEST_TARGET}. However, I’m not sure it’s either possible or necessary to integrate path resolution into the config decoder, since there are two sources for target paths: the config file and CLI parameters. If the resolver were integrated into the config, it would have to be duplicated in the CLI as well.

Instead, to avoid code duplication, I added factories for the Tests and Playbook command parameters that merge the CLI inputs with configs and then resolve the paths. This also guarantees that the correct values are always used for the TARGET and TEST_TARGET variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants