Closed malaire closed 3 years ago
What would the use case for this be?
For example in my malaire/elm-uint64
package I would prefer division-related functions to throw runtime exception on division-by-zero, but as such behavior can't be tested currently, and I only want to implement testable behavior, I was forced to return 0
instead on division-by-zero as that can be tested.
You could test this be creating an elm application that does division by 0 and then running it in node. One could run this node script as part of CI even.
try {
Elm.Main.init();
} catch (e) {
assert(...);
return;
}
throw new Error("did not crash at runtime");
Given that getting a runtime crash requires some sort of hack on the part of the library, I think needing a separate test script for this behavior is probably not unreasonable.
Requiring using node directly is unreasonable. I accept that I need it undirectly (e.g. elm-test requires node) but I will never use node directly.
How does direct and undirect use of node differ? It is hard to run javascript with out node. I guess you could try and hook something up with deno if you were so inclined.
I consider any use of node/npm to be a serious bug. But as elm-test
is the only way to run Elm tests I accept using it for now.
I think this would work in deno or in the browser which should cover you here.
I do not think an API such as you propose here is in scope for this package at this time unfortunately.
I am going to close this issue as it looks like there is nothing actionable we can do here and there is a work around. @malaire please do reopen if I am missing anything :)
For example: