-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run signal of IOs #8
Comments
The IO type is a chain of operations which doesn't ever idle. It is either actively processing an IO operation, or blocking on waiting for user input. This is similar to how you would write an old console application in C, as opposed to JS apps which have a mainloop and remain idle until the next event comes. If you look at how IO is implemented, every operation (except exit) has a mandatory next operation (see the comment on this line). So you cannot just say run one IO and then go idle. In IO apps there is no concept of idle. You either perform the next operation or exit. Can I ask how you got to a |
@laszlopandy so, I was trying to test an effect that sends an action to a mailbox, and I want to map over that mailbox signal and make the expectation there. That's why I end up with a Right now, the way it knows when it's "the last test" is that it starts running the specs, but if another Signal Test value comes along before the This could be replaced with a waiting period maybe. Wait for X seconds then executes all tests on the signal. |
Hello,
So, I'm using elm-console to run elm-test tests. But I have the case where I'm trying to test signals and effects.
Long story short, I manage to end up with a
Signal Test
, and I need to map those tests toconsoleRunner
thenConsole.run
to run the tests each time a new test comes from the signal.But
Console.run
takes an IO and returns a Signal of Tasks, so I would end up withSignal (Signal (Task.Task x ()))
, and Signal of Signals aren't allowed in elm.My workaround to solve this was creating this library: signal-concat-map that allows me to
concatMap
signals, by using native modules.You can check out the final code of the TestRunner here.
I wouldn't need this if there was a way to run signals of IO, like this:
Is this possible in elm-console?
Thanks!
The text was updated successfully, but these errors were encountered: