Repository navigation
Add --report-dir option and reportsFolder setting for report output - #2099
Open
waldekmastykarz wants to merge 1 commit into
Open
waldekmastykarz wants to merge 1 commit into
waldekmastykarz wants to merge 1 commit into
Conversation
Reporters wrote reports to Dev Proxy's current working directory, forcing scripts to change cwd (which also changes how config paths resolve) just to control where reports land. - New reportsFolder setting in devproxyrc.json, resolved relative to the config file (supports ~/, ~appFolder, ~dataFolder tokens) - New --report-dir option, resolved relative to the working directory, which overrides reportsFolder - BaseReporter writes to the folder (creating it if needed); default stays the working directory - Updated v4.0.0 rc schema Closes dotnet#2071 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the configurable reporter output-folder change.
No open issues 🎉
What changed in this PR
Adds configurable output folders for Dev Proxy reporters without changing the working directory or config discovery behavior.
Changes:
- Adds
reportsFolderand the overriding--report-diroption, with config-relative and working-directory-relative path resolution respectively. - Updates JSON, Markdown, and plain-text reporters to create and use the selected folder while preserving timestamp suffixes and the default working-directory behavior.
- Adds unit and integration coverage for path resolution and report output.
| File | Description |
|---|---|
schemas/v4.0.0/rc.schema.json |
Documents the reportsFolder setting. |
DevProxy/Proxy/ProxyConfiguration.cs |
Resolves configured report paths relative to the config file. |
DevProxy/Commands/DevProxyCommand.cs |
Adds, validates, and applies --report-dir. |
DevProxy.Tests/ReportsFolderTests.cs |
Tests config and CLI path resolution. |
DevProxy.Tests/Fakes.cs |
Adds the report-folder property to the test fake. |
DevProxy.Plugins/Reporters/PlainTextReporter.cs |
Passes proxy configuration to the base reporter. |
DevProxy.Plugins/Reporters/MarkdownReporter.cs |
Passes proxy configuration to the base reporter. |
DevProxy.Plugins/Reporters/JsonReporter.cs |
Passes proxy configuration to the base reporter. |
DevProxy.Plugins/Reporters/BaseReporter.cs |
Creates and uses the output folder; retains the original constructor. |
DevProxy.Integration.Tests/TestProxyConfiguration.cs |
Adds report-folder support to integration test configuration. |
DevProxy.Integration.Tests/ReporterReportsFolderTests.cs |
Tests folder creation, timestamp suffixes, and working-directory fallback. |
DevProxy.Integration.Tests/JsonReporterTests.cs |
Updates reporter construction to supply configuration. |
DevProxy.Abstractions/Proxy/IProxyConfiguration.cs |
Exposes the report output folder in the configuration contract. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2071
Problem
Reporters wrote reports to a relative file name, so they always landed in Dev Proxy's current working directory. Scripts that wanted reports elsewhere had to start Dev Proxy with a different
cwd, which also changes how relative config paths anddevproxyrc.jsondiscovery resolve.Changes
reportsFoldersetting indevproxyrc.json. Relative paths resolve against the config file's folder (like other paths in config files);~/,~appFolder, and~dataFoldertokens are supported.--report-dir <path>CLI option. Relative paths resolve against the current working directory (standard CLI behavior) and overridereportsFolder. Rejects a path that points to an existing file.BaseReporter(Json, Markdown, PlainText reporters) writes to that folder and creates it if needed. The existing "file exists → append timestamp" behavior is preserved inside the folder. Default is unchanged: the working directory.IProxyConfiguration.ReportsFolderadded;BaseReportergets a new constructor overload takingIProxyConfiguration. The original constructor is kept so third-party reporters keep compiling (they keep writing to the cwd).schemas/v4.0.0/rc.schema.jsondocumentsreportsFolder.Scope note
Generator plugins (HAR, mocks, OpenAPI, TypeSpec,
.http) also write files to the cwd. I left them out to keep this PR to the reporters the issue calls out; happy to follow up if we want them to honor the same folder.Testing
--report-dirresolution (incl.~/).reportsFolderin config → report lands next to the config file;--report-dirwith--detach→ report lands relative to the invoking cwd.