Support automated tests that need a terminal emulator#13033
Support automated tests that need a terminal emulator#13033yizhepku wants to merge 17 commits intonushell:mainfrom yizhepku:alacritty-terminal
Conversation
|
I've tested this on Windows and Linux, but it's not working on MacOS yet. I guess I'll dig up my old Macbook.
EDIT: Nevermind, it's not a MacOS issue. |
|
Thanks for this. If we can get this green, it has the potential to significantly help with testing things we cannot test today. I'm excited about this PR! |
|
Turns out the CI failure had nothing to do with MacOS. The problem was that there is no |
|
Good catch. Seems like there should be a |
Isn't |
|
It doesn't technically load a default config. That's why when you run |
|
In any case, The test case for PWD-aware command hints actually had to set some configs (PWD-aware command hints only work with the sqlite backend, which you explained to me not long ago). The workaround is to create a temporary config file and set both |
|
I wanted to add a test for system-clipboard integration, but I don't understand how Reedline handles it. In particular, I think Ctrl-Shift-C have the same ANSI escape code as Ctrl-C, so how does Reedline differentiate them over SSH? |
|
This is very cool! The |
That sounds good.
I tried a number of approaches (including polling), and sleeping for 500ms seemed to be the most reliable option. I don't really understand what is causing the issue, though, so take it with a grain of salt. In any case, sleeping for 500ms should have little impact on debugging and CI. |
I'm not sure I agree. We have a lot of tests and parallelism is limited. Waiting for 500ms is not a huge deal in 1 or 2 tests but if we start adding more terminal emulator tests this kind of Starting up |
Really? When I test locally, my CPU usage is saturated at 100% a lot, so I was not expecting Shouldn't parallelism solve the problem? Individual tests would certainly be a lot slower, but I'm hoping that this wouldn't affact CI test time. |
|
Tools like I often run |
|
What is needed to make progress on this endeavour? Would love to see those added tests, as long as we do not grind our CI to a halt. |
Possibly nothing. I think the |
|
Closing in favor of nushell/reedline#847, which implements the same functionality without using |
|
There may be some rare other places where we want to mock the user interactions like the |
This PR adds support for tests that need a terminal emulator. It adds the
alacritty_terminalcrate as a dev-dependency. The terminal state is kept in memory (no actual rendering takes place) and connected to a Nushell process via a PTY.Two test cases are added as a demonstration, one for auto-cd and one for PWD-aware command hints.