DevanB / xstate-examples

Practical examples of statechart-based solutions with xstate.
138 stars 12 forks source link

Svelte example lacks test command #255

Open justinmoon opened 4 years ago

justinmoon commented 4 years ago

Instructions say to run:

yarn && yarn test

I get:

$ yarn test
yarn run v1.22.4
warning package.json: No license field
error Command "test" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

package.json seems to lack a test command.

DevanB commented 4 years ago

Hey @justinmoon!

Thanks for opening a story. I've actually been struggling to get testing working in all three examples. It seems that model-based testing is actually not as easy as David Khourshid likes to show. In fact, the last attempt I had at building a model-based testing solution for these trivia game examples proved to me that I would have to remove all guards, transient transitions, and invoke calls in the machine that is tested against (not the app machine). Doing this means the machine is effectively a welcome state, a quiz state that displays only one question, and a results state. Based on this finding, I've questioned how much model-based testing in these examples helps.

I'd be curious to know if a Cypress E2E test be more beneficial to someone like yourself who is looking at these examples?

I'm curious your thoughts; share them all as I'm passionate about helping others try to understand why and why not to use state machines in their library/framework/language of choice.