Closed atari-monk closed 1 year ago
I cleaned this up in test so it can pass just letting you know about it if u didnt encoutered it
Can you provide a formatted (three backticks, code block) example of the output for the VS run and the dotnet cli run for comparison?
Sorry i dont know this formating thing. This is output to txt file from VSCode run test VSCode-RunAllTests.zip This is output from dotnet test Dotnet test.zip I use notepad++ with endline switch on or this https://www.diffchecker.com/. To compare it. My test table looks like this
[17:57:14 INF] Read Item
┌──────┬───────────┐
│ Id │ Name │
├──────┼───────────┤
│ 1639 │ Christine │
└──────┴───────────┘
I add code like this, to clean white spaces so test will pass
var linesOut = outputText!.Split(EOL).ToList();
var length = linesOut[0].IndexOf("┐") + 1;
linesOut[0] = linesOut[0].Substring(0, length);
linesOut[2] = linesOut[2].Substring(0, length);
linesOut[4] = linesOut[4].Substring(0, length);
PrintToFile(expected, linesOut);
outputText = string.Join(EOL, linesOut);
Assert.Equal(expected, outputText);
Not a big deal, still learning to use this lib.
Looks like they are different
VSCode RunAllTests:
839dc8c1e298ab9b30b90fe0ef018859deb7dfb2b8aee18f502dc8ffb4ee354d
839dc8c1e298ab9b30b90fe0ef018859deb7dfb2b8aee18f502dc8ffb4ee354d
Dotnet Test
cf64b2fefc18c9464e1aaddf82ef4b90bb7a938722a57e9c54911d836ea979fd
fe4b8563de8560584489246a53ddf4d0cfe66637a7fdd7053e8d7abceaadbcd9
Are either of these being ran in a terminal or with a console available at runtime, or are they being ran headless?
The dotnet test one is padding the end of the output with whitespace, which is behavior I would expect if Console
is available at runtime.
sorry i dont know I just use Link in class test to run tests from VSCode and in VSCode terminal i type dotnet test to run theese. i dont know how this affects stuff. I also use CommandDotNet lib It was just something weird for me so i wanted to show it to better coder. I'am implementing rest of the columns and it;s not a problem.
Unfortunately I would need to know if Console is available to further help debug this and/or a repro that I can run.
You can test this by asserting if the console is or is not available during your tests.
Code is in my repos (inventory-min-cli-app), it's difficult to build thow since it consists of many separate projects. I dont know how to assert this. Will google this.
You can see how I'm checking for the console here:
This can throw an exception, so wrap in try/catch block. Exception probably means no console available, that's what I assume anyways.
You can always assign this to a variable, debug your tests, and see if that variable is true/false.
Do you still need he;p with this problem?
No i dont. It worked then in 2022. Probably still works. Not using this app at the moment. I like library. It works fine for me. You can close, thx.
Hi @douglasg14b
I found somethig weird in my testing I compare table printout to expected string in my integration test. When i run test from Visual Studio all is fine. When i run test in dotnet test cli command it sqrews up printout. Speciffically it adds whitespaces and test failes ┌──────┬───────────┐
│ [38;2;250;250;210m Id [0m │ [38;2;0;128;0m Name [0m │ ├──────┼───────────┤
│ [38;2;250;250;210m1291[0m │ [38;2;0;128;0mChristine[0m │ └──────┴───────────┘
Look at the space after ┌──────┬───────────┐ There id plenty of whitespaces there. They show up only when test is run thrue dotnet test Can you comment that ?