Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Change test script to interactive mode #328

@AWolf81

Description

@AWolf81

At the moment, tests inside Guppy are running once and the user need to re-run manually. As @joshwcomeau mentioned in a comment that's a temporary hack.

It was a good idea from Josh to do this later as this is a pretty large task. But maybe two people could work on this.
One for implementing the UI with jest-stare and the other for parsing/handling the interactive commands. But it's also possible to tackle this with-out splitting - just do it like this: First UI then command handling or start with a minimal temporary UI and work on the business logic first then improve UI.

Is your feature request related to a problem? Please describe.
UX could be better if it would be possible to use interactive mode.

Describe the solution you'd like
By removing line 188 to 190 in task.saga. We're running in interactive mode and the output in a terminal will look like in the following screenshot (ran in a real terminal as the Guppy output seems to be filtered):
grafik

Todos
UI

  • Remove terminal from test preview as we're rendering everything to the UI
  • The status should change if the interactive test is passing to green & on fail to red.
  • Extract every info from the terminal output from top down to string Watch usage. Maybe we could also change to a json reporter so it's easier to get the output - not sure if this is working with interactive mode.
  • Render the test result - I think we could use jest-stare to render it.
  • Show progress bar & expected test time (optional, less important)
  • Create a UI element for each command:
    • Run all tests a key
    • Run only failed tests f key
    • Filtering p & t key with a input field
    • Stop tests q key
    • Re-run test enter key
  • Use the same keys as keyboard shortcuts so it's possible to trigger them with keyboard.

Command handling

  • Create a runTest generator in task.saga that's listening for a Redux action that will pass the command to the test child process. So you have to use take(stdioChannel) and takeEvery(TRIGGER_TEST_COMMAND, handleTestCommand) inside a while(true) loop.
  • handleTestCommand will use sendCommandToProcess to send the command passed with the action TRIGGER_TEST_COMMAND to the test child process.

Edge cases

  • What happens if a snapshot needs to be updated? Parse the info from the output and display a button & also show a list of snapshot files that are not matching so they can be opened in editor. Jest-stare is already doing a nice diff display - maybe we could display this if we're detecting that a snapshot failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions