haskell / haskell/haskell-language-server

Update documentation for running tests

Open
#3,844 2 comments 0 reactions 0 assignees View on GitHub
documentation level: easy type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

## Is your enhancement request related to a problem? Please describe.

[The contributing guide mentions this alternative:](https://github.com/haskell/haskell-language-server/blob/c0f7d4c40ba2c63dabcaeb4f49e91a6de8c8a984/test/utils/Test/Hls/Command.hs#L10-L19)
```shell
cabal run haskell-language-server:func-test -- -p "hlint enables"
```

This is supposed to work around Cabal flushing caches when using `--test-options`:
* haskell/cabal#6114

But that does not work, because Cabal does not set executables to PATH for `run`:
* haskell/cabal#8391

And thus `runSession` produces this slightly confusing message:
```
haskell-language-server
window/workDoneProgress
sends indefinite progress notifications: FAIL
Exception: haskell-language-server: createProcess: posix_spawnp: does not exist (No such file or directory)
```

## Describe the solution you'd like

The contributing guide should probably be updated to mention this error and link to the Cabal bug.

As a temporary workaround, the tests could check that the executable exists and print more helpful error.

## Describe alternatives you've considered

The users can set `HLS_TEST_EXE` and `HLS_WRAPPER_TEST_EXE` like CI does, but that seems brittle.

https://github.com/haskell/haskell-language-server/blob/c0f7d4c40ba2c63dabcaeb4f49e91a6de8c8a984/test/utils/Test/Hls/Command.hs#L10-L19
## Additional context

I hit this long ago and @pepeiborra helpfully pointed out that this does not work in #2837, but I have since forgotten about it. 😅

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.