Conditionally running a git hook or command #45
-
I want to be able to run my integration tests (I know not the best, but I have reasons) before code is committed, but only if any of the staged files meet a certain condition. I tried creating a csx file and passing the
If a test fails, the exception is shown in the terminal, but the commit goes through. This may be outside the scope of this package and thats fine, but I wanted to make sure there wasnt an easier way since this is the first time Ive worked with csx files. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @forrestab, In the CSX files, you can return an exception or non-zero exit code to break the execution (e.g var x = Process.Start("dotnet", "test src/IntegrationTests/");
x.WaitForExit();
return x.ExitCode; but this is an interesting problem, I'll look for an easier way to handle this soon, feel free to open an issue if you have any suggestions to make this operation easier. |
Beta Was this translation helpful? Give feedback.
Hi @forrestab,
In the CSX files, you can return an exception or non-zero exit code to break the execution (e.g
if (some condition) return 1
),but this is an interesting problem, I'll look for an easier way to handle this soon, feel free to open an issue if you have any suggestions to make this operation easier.