elm-explorations / elm-explorations/test

Testing any value containing a Process.Id

Open
#72 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
244
Forks
40
Avg merge
1d 23h
Merged PRs (30d)
2

Description

The issue is similar to this one: https://github.com/elm-explorations/test/issues/24

We have a model containing a `Process.Id` (so that we can kill/restart it), but there is no way to create one for testing, since the `Platform` module don't export the constructor, which makes perfectly sense when you target production code, but not in the context of testing.

A very generic solution to this kind of problems would be to add conditional compilation, so that instead of:

```elm
module Platform exposing
( Program
, ...
, ProcessId
, ...
)
```

We could write:
```elm
module Platform exposing
( Program
, ...
# if env == test then
, ProcessId(..)
# else
, ProcessId
# end
, ...
)
```

Notice that this would solve a lot of other problems (like #24, `Debug.log` calls, etc...).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.