Skip to content

Commit 9dfda3c

Browse files
Added test for passing environment variables
1 parent 683f6a4 commit 9dfda3c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/suite/extension.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ suite('Extension Test Suite', () => {
6565
await getHaskellConfig().update('logFile', 'hls.log');
6666
await getHaskellConfig().update('trace.server', 'messages');
6767
await getHaskellConfig().update('releasesDownloadStoragePath', path.normalize(getWorkspaceFile('bin').fsPath));
68+
await getHaskellConfig().update('serverEnvironment', { XDG_CACHE_HOME: path.normalize(getWorkspaceFile('cache-test').fsPath) });
6869
const contents = new TextEncoder().encode('main = putStrLn "hi vscode tests"');
6970
await vscode.workspace.fs.writeFile(getWorkspaceFile('Main.hs'), contents);
7071
});
@@ -99,6 +100,14 @@ suite('Extension Test Suite', () => {
99100
assert.ok(await withTimeout(30, existsWorkspaceFile('hls.log')), 'Server log not created in 30 seconds');
100101
});
101102

103+
test('Server should inherit environment variables defined in the settings', async () => {
104+
await vscode.workspace.openTextDocument(getWorkspaceFile('Main.hs'));
105+
assert.ok(
106+
await withTimeout(30, existsWorkspaceFile('cache-test/*.hiedb')),
107+
'Server did not inherit XDG_CACHE_DIR from environment variables set in the settings'
108+
);
109+
});
110+
102111
suiteTeardown(async () => {
103112
disposables.forEach((d) => d.dispose());
104113
await vscode.commands.executeCommand(CommandNames.StopServerCommandName);

0 commit comments

Comments
 (0)