DiffEngine manages launching and cleanup of diff tools. It is designed to be used by any Snapshot/Approval testing library.
See Milestones for release notes.
Currently used by:
Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.
- NuGet
- Supported Tools
- Launching a tool
- Closing a tool
- File type detection
- BuildServerDetector
- AiCliDetector
- Disable for a machine/process
- Disable in code
- Icons
- Tools
- Tool Order
- Custom Tool
- DiffEngineTray
- Code versus machine level settings
- BeyondCompare Windows/OSX/Linux (Cost: Paid)
- P4Merge Windows/OSX/Linux (Cost: Free)
- Kaleidoscope OSX (Cost: Paid)
- DeltaWalker Windows/OSX (Cost: Paid)
- WinMerge Windows (Cost: Free with option to donate)
- TortoiseGitMerge Windows (Cost: Free)
- TortoiseGitIDiff Windows (Cost: Free)
- TortoiseMerge Windows (Cost: Free)
- TortoiseIDiff Windows (Cost: Free)
- KDiff3 Windows/OSX (Cost: Free)
- TkDiff OSX (Cost: Free)
- Guiffy Windows/OSX (Cost: Paid)
- ExamDiff Windows (Cost: Paid)
- Diffinity Windows (Cost: Free with option to donate)
- Rider Windows/OSX/Linux (Cost: Paid with free option for OSS)
- Vim Windows/OSX (Cost: Free with option to donate)
- Neovim Windows/OSX/Linux (Cost: Free with option to sponsor)
- AraxisMerge Windows/OSX (Cost: Paid)
- Meld Windows/OSX/Linux (Cost: Free)
- SublimeMerge Windows/OSX/Linux (Cost: Paid)
- VisualStudioCode Windows/OSX/Linux (Cost: Free)
- Cursor Windows/OSX/Linux (Cost: Free and Paid)
- VisualStudio Windows (Cost: Paid and free options)
- MsWordDiff Windows (Cost: Free)
A tool can be launched using the following:
await DiffRunner.LaunchAsync(tempFile, targetFile);Note that this method will respect the above difference behavior in terms of Auto refresh and MDI behaviors.
A tool can be closed using the following:
DiffRunner.Kill(file1, file2);Note that this method will respect the above difference behavior in terms of MDI behavior.
DiffEngine use EmptyFiles to determine if a given file or extension is a binary or text. Custom extensions can be added, or existing ones changed.
BuildServerDetector.Detected returns true if the current code is running on a build/CI server.
Supports:
There are also individual properties to check for each specific build system
var isWsl = BuildServerDetector.IsWsl;
var isTravis = BuildServerDetector.IsTravis;
var isJenkins = BuildServerDetector.IsJenkins;
var isGithubAction = BuildServerDetector.IsGithubAction;
var isAzureDevops = BuildServerDetector.IsAzureDevops;
var isTeamCity = BuildServerDetector.IsTeamCity;
var isGitLab = BuildServerDetector.IsGitLab;
var isMyGet = BuildServerDetector.IsMyGet;
var isGoDc = BuildServerDetector.IsGoDc;
var isDocker = BuildServerDetector.IsDocker;
var isAppVeyor = BuildServerDetector.IsAppVeyor;BuildServerDetector.Detected can be set at test time. The value is stored in an AsyncLocal, so it is scoped to the current async context and does not leak to other threads or tests running in parallel.
[Fact]
public async Task SetDetectedPersistsInAsyncContext()
{
var original = BuildServerDetector.Detected;
try
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
await Task.Delay(1);
Assert.True(BuildServerDetector.Detected);
}
finally
{
BuildServerDetector.Detected = original;
}
}
[Fact]
public async Task SetDetectedDoesNotLeakToOtherContexts()
{
var parentValue = BuildServerDetector.Detected;
await Task.Run(() =>
{
BuildServerDetector.Detected = true;
Assert.True(BuildServerDetector.Detected);
});
Assert.Equal(parentValue, BuildServerDetector.Detected);
}AiCliDetector.Detected returns true if the current code is running in an AI-powered CLI environment.
Supports:
There are also individual properties to check for each specific AI CLI
var isCopilot = AiCliDetector.IsCopilot;
var isCursor = AiCliDetector.IsCursor;
var isAider = AiCliDetector.IsAider;
var isClaudeCode = AiCliDetector.IsClaudeCode;Set an environment variable DiffEngine_Disabled with the value true.
DiffRunner.Disabled = true;
Game designed by Andrejs Kirma from The Noun Project.
Tray icons from LineIcons.
