droyad / assent Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I'm using this library to basically hold functionality in place in a large legacy app I'm refactoring. The current behavior of the application, for better or worse, is what I want to preserve.
To do this I'm generating and running thousands of approval-based tests that describe how data interacts with the application, which means it's pretty painful to manually go through and approve every diff using my diff tool. I need some kind of option to approve everything the first time I run it, possibly an env var.
Would this be a change you'd be open to having?
These two links don't work.
In markdown, they need to be updated to;
I have winmerge installed, but it's not detected as a merge tool. Would you consider including support for it out of the box?
When the tests fail on a build server, it is really convenient if the diff can be investigated without needing to remote onto the machine.
We do this with TeamCity by publishing the two files as artifacts.
It would be nice to add a callback you can hook into when a test fails, which passes the full path to the files, so you can add your own logic for your build server of choice.
What do you think?
When you create a configuration it creates a DiffReporter
When you create a DiffReporter it creates instances of the default comparers and somewhere in there its throwing an error when run on OSX.
So the custom configuration is basically ignored...
I need to dig a bit further to properly understand what part of the constructor sequence is causing the error.
The BC UI shows the received file as missing as it has been deleted by the time the UI has been shown
The finally
in the Compare
function is being executed immediately
https://github.com/droyad/Assent/blob/master/src/Assent/Engine.cs#L59
When running Assent
on OS-X 11.2.2 Big Sur with default install of BeyondCompare and VS-Code Assent fails to find either of them. bcompare
has installed to /usr/local/bin/bcompare
/usr/bin % which bcompare
/usr/local/bin/bcompare
Looks like on mac and linux environments that any flags passed to bcompare
need to be supplied using a single -
characters, whereas on windows /
is used. Since Assent leans on the /solo
flag, this tries to open as a 3-way merge on Linux.
From the docs
In my test, I am using a reporter that has the vscode diff program in:
However the Assent
throws an exception that it could not find a diff program to use:
System.Exception: 'Could not find a diff program to use'
Yet if I look at the searchpaths to Code.exe
it is correct.
Not sure what I am doing wrong?
Here is the configuration code:
// Now verify the xml looks good.
var configuration = new Configuration().UsingExtension(".xml");
var programs = new IDiffProgram[] {
new VsCodeDiffProgram()
}
.Concat(Assent.Reporters.DiffReporter.DefaultDiffPrograms)
.ToArray();
var reporter = new Assent.Reporters.DiffReporter(programs);
configuration.UsingReporter(reporter);
// This throws.
this.Assent(xmlStringBuilder.ToString(), configuration);
And I am running the test under netcoreapp2.0
I'm running my tests on CI machines that don't have a diff program installed.
It seems reasonable to me that this library would include a built in diff reporter so it doesn't have to depend on other programs being installed on the machine.
I bet there are decent diff nugets out there, its possible to just use on of them.
Great work!
When using MEld as a comparison tool - meld automatically inserts an EOL on the last line of text (as per POSIX standard).
When the assent test is re-run against the Meld generated file, the comparison fails, as the approval file contains an extra EOL which does/may not exist in generated string.
Found on Ubuntuy 22.04.
Using CallerFilePath (https://github.com/droyad/Assent/blob/master/src/Assent/Extensions.cs#L12) captures the file path during compilation.
I had a very weird problem that on my CI (teamcity) i was building the project in one build and passed the built output to another build that runs the tests, the filepath was wrong and my approved files were always empty.
Maybe the more conventional way is to use the working dir ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.