You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the option --use-mapping-file to coverlet.console that allows the
caller to specify a custom source mapping file to use. This is used to
then maps paths located in an assembly's debug symbols to local path
when collecting coverage.
8
Copy file name to clipboardExpand all lines: Documentation/GlobalTool.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ Options:
37
37
--use-source-link Specifies whether to use SourceLink URIs in place of file system paths.
38
38
--does-not-return-attribute Attributes that mark methods that do not return.
39
39
--exclude-assemblies-without-sources Specifies behaviour of heuristic to ignore assemblies with missing source documents.
40
+
--use-mapping-file Specifies the path to a SourceRootsMappings file.
40
41
--version Show version information
41
42
-?, -h, --help Show help and usage information
42
43
```
@@ -237,6 +238,18 @@ You can also include coverage of the test assembly itself by specifying the `--i
237
238
238
239
Coverlet supports [SourceLink](https://github.com/dotnet/sourcelink) custom debug information contained in PDBs. When you specify the `--use-source-link` flag, Coverlet will generate results that contain the URL to the source files in your source control instead of local file paths.
239
240
241
+
## Path Mappings
242
+
243
+
Coverlet has the ability to map the paths contained inside the debug sources into a local path where the source is currently located using the option `--source-mapping-file`. This is useful if the source was built using a deterministic build which sets the path to `/_/` or if it was built on a different host where the source is located in a different path.
244
+
245
+
The value for `--source-mapping-file` should be a file with each line being in the format `|path to map to=path in debug symbol`. For example to map the local checkout of a project `C:\git\coverlet` to project that was built with `<Deterministic>true</Deterministic>` which sets the sources to `/_/*` the following line must be in the mapping file.
246
+
247
+
```
248
+
|C:\git\coverlet\=/_/
249
+
```
250
+
251
+
During coverage collection, Coverlet will translate any path that starts with `/_/` to `C:\git\coverlet\` allowing the collector to find the source file.
252
+
240
253
## Exit Codes
241
254
242
255
Coverlet outputs specific exit codes to better support build automation systems for determining the kind of failure so the appropriate action can be taken.
Copy file name to clipboardExpand all lines: src/coverlet.console/Program.cs
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,7 @@ static int Main(string[] args)
48
48
varuseSourceLink=newOption<bool>("--use-source-link","Specifies whether to use SourceLink URIs in place of file system paths."){Arity=ArgumentArity.Zero};
49
49
vardoesNotReturnAttributes=newOption<string[]>("--does-not-return-attribute","Attributes that mark methods that do not return"){Arity=ArgumentArity.ZeroOrMore};
50
50
varexcludeAssembliesWithoutSources=newOption<string>("--exclude-assemblies-without-sources","Specifies behaviour of heuristic to ignore assemblies with missing source documents."){Arity=ArgumentArity.ZeroOrOne};
51
+
varsourceMappingFile=newOption<string>("--source-mapping-file","Specifies the path to a SourceRootsMappings file."){Arity=ArgumentArity.ZeroOrOne};
0 commit comments