Closed malaire closed 3 years ago
Looks like Node supports worker-threads since 10.5 with --experimental-worker
command line switch, and since 12.0 without that switch.
ps. Node 10.21.0 is the latest version in Debian 10. Debian 11 is due around next summer and will have Node 12.x
Node.js 10 is EOL 2021-04-30: https://nodejs.org/en/about/releases/
That's a bit annoying indeed. Worker thread is a key aspect of the work distribution chosen for elm-test-rs. Node-test-runner was based on node processes and named pipes but it was causing issues apparently and some hacks are present in the code base for this. I don't think I'm willing to go back to something else than worker threads for supervisor-runners communication.
I'm not familiar with Debian, are there some alternatives? Is it possible to install software that is not in the repository? maybe if that's the case, a Deno variant would be compatible with it?
I'm not familiar with Debian, are there some alternatives? Is it possible to install software that is not in the repository?
It is possible to install additional unofficial repositories and newer Node can be installed that way, but that can make Debian less stable. Personally I'd rather use Deno than Node from unofficial repository. (I don't currently have time to try Deno, but as I love Rust I'll definitely get to that eventually.)
Potential solution to support Node 10.x could be to detect Node version and use --experimental-worker
for 10.x - but I don't know how feasible that is (or how "experimental" that feature was in 10.x).
I just tried inside a debian container and it seems to be working. To try it, I run elm-test-rs
, which crashed, but after generating all the necessary files inside elm-stuff/
. Then I moved inside elm-stuff/tests-0.19.1/js/
, run node with the experimental option and entered via stdin the path to the compiled runner:
root@cd327f072613:/app/elm-stuff/tests-0.19.1/js# nodejs --experimental-worker node_supervisor.js
/app/elm-stuff/tests-0.19.1/js/node_runner.js
Running 1 tests. To reproduce these results later, run:
elm-test-rs --seed 1924657170 --fuzz 100 (TODO: pass files to reporter)
◦ TODO: Implement the first test. See https://package.elm-lang.org/packages/elm-explorations/test/latest for how to do this!
TEST RUN INCOMPLETE because there is 1 TODO remaining
Duration: 2 ms
Passed: 0
Failed: 0
Todo: 1
Running duration (since Node.js start): 4863 ms
So it seems that the usage of workers in elm-test-rs is working. I haven't covered 100% of the JS code though. I've no idea if I've used JS syntax for example that may not be supported in Node 10.
The node --version
command seems to be quick to answer, taking few milliseconds. So I guess checking the node version can be done if that enables support for debian. Here is where node is invoked if you want to give it a try: https://github.com/mpizenberg/elm-test-rs/blob/466f3415ddb2e1bf4b9b006031cdf7fd85f2ada2/src/run.rs#L356
Normally using an --experimental
flag would be bad but in this case (specific range of nodejs when the feature is stable in later versions) there is no risk of the unstable feature changing and causing problems so this approach looks good to me
OS: Debian 10 Node: v10.21.0 Elm: 0.19.1
Trying to run elm-test-rs 0.4.1 for
malaire/elm-uint64
fails with following error: