emmet-language-server: add smoke test

This was taken from vtsls.

(cherry picked from commit 888551d011)
This commit is contained in:
Gutyina Gergő
2026-06-11 01:33:51 +02:00
committed by github-actions[bot]
parent 9e72436441
commit feaebe9d26

View File

@@ -8,6 +8,8 @@
pnpmBuildHook,
fetchFromGitHub,
nix-update-script,
runCommand,
emmet-language-server,
}:
let
pnpm = pnpm_11;
@@ -60,7 +62,24 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
passthru = {
updateScript = nix-update-script { };
tests.smoke = runCommand "emmet-language-server-smoke-test" { } ''
INIT_REQUEST='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":"file:///tmp","workspaceFolders":[{"uri":"file:///tmp","name":"test"}],"capabilities":{}}}'
CONTENT_LENGTH=''${#INIT_REQUEST}
RESPONSE=$(
{
printf "Content-Length: %d\r\n\r\n%s" "$CONTENT_LENGTH" "$INIT_REQUEST"
sleep 1
} | timeout 3 ${lib.getExe emmet-language-server} --stdio 2>&1 | head -c 1000
) || true
echo "$RESPONSE" | grep -q '"capabilities"'
touch $out
'';
};
meta = {
description = "Language server for emmet.io";