-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Check that the tests compile, directly in the language server #662
Comments
While this is nice, I'm not sure why it would be worth it. We don't want to just know if it parses, we also want to run the tests. So we can't drop the dependency on elm-test after this anyway? |
Well if this seems rather easy to you, going just the extra mile to be able to also run the tests should be a breeze. You see the full steps to get the tests to run are as follow:
So step 4/5 consists in compiling the Step 6 consists in compiling Finally step 7 consists in filling the
|
can't we just use elm-test-rs as a web assembly? |
Nope it's impossible, or too complicated because webassembly doesn't have the capabilities to interact with the outside world, so reading and writing files, talking to the net, etc. There is a standard called WASI, which enables that but it's not broadly supported yet in webassembly runtimes. And even then, there are some dependencies in elm-test-rs, for SSL, which are not possible to compile to wasm with WASI. So no, it's not possible. |
In my opinion, if I manage to do the dependency solver as wasm thing, integrating the rest to have a fully working tests runner within the language server is a matter of 2 hours of pair programming with both of us. |
Sounds about right, I think we could spend more time on some edge cases after that and exposing the server to the client for the test integration. |
If I'm correct, currently elmls is using
elm-test make
to figure out if the tests are compiling. And we've had some discussions if it could be useful to useelm-test-rs make
since this does not spin up aNode
process and is thus faster. But what if this could be done easily, directly in the language server instead? Let me explain.The steps to do this, which are roughly the steps done by elm-test-rs are the following:
I don't know the code base of the language server, but if I had to guess I'd mark each of those tasks as follows:
Generation of correct dependencies can be a bit tricky and resulted in many edge case bugs in elm-test before it used elm-json for this. And in elm-test-rs, we use pubgrub for this. The thing is, I'm fairly confident that I could extract some code from elm-test-rs and make a WebAssembly module, wrapped in an npm JavaScript package with the following function:
Generating the
Runner.elm
file just consists in filling the following template by remplacing the{{ imports }}
, so I believe it could be easy todo with what you already currently have in the language server.Let me know what you think of this.
The text was updated successfully, but these errors were encountered: