xstate icon indicating copy to clipboard operation
xstate copied to clipboard

Description key should appear in the Jest console.

Open aisflat439 opened this issue 3 years ago • 0 comments

Description

In this thread I explained what I expected the behavoir to be. David recommended I post this here.

Suppose I have a straightforward model:

const machine = createTestMachine({
  id: "commandPaletteMachineTest",
  initial: "closed",
  states: {
    closed: {
      on: {
        "control p": {
          target: "open",
        },
      },
    },
    open: {
      on: {
        "keypress Escape": {
          target: "closed",
        },
      },
    },
  },
});

Jest console renders something like this:

    ✓ Reaches state "#commandPaletteMachineTest.closed": control p → keypress Escape (89 ms)

This makes sense. I have "description" keys on each state so I'd expect if I update the previous to:

   open: {
      on: {
        "keypress Escape": {
          description: "cool message for the console!"
          target: "closed",
        },
      },
    },

I would get something like:

    ✓ Reaches state "#commandPaletteMachineTest.closed": control p → keypress Escape "cool message for the console!" (89 ms)

Expected result

The expected result is descriptions appear in the jest console.

Actual result

There was no description in the jest console.

Reproduction

none

Additional context

No response

aisflat439 avatar May 31 '22 16:05 aisflat439