-
Notifications
You must be signed in to change notification settings - Fork 9
Testing
Paul Jolly edited this page Jan 3, 2025
·
12 revisions
For now, we do not have any (meaningful) end-to-end/integration tests. For now therefore we run through the following scenarios offline using VSCode. This list could/should form the basis for the later addition of real automated tests that cover these situations.
For the purposes of these tests, the following scenario "shorthands" are delcared:
- A valid workspace refers to a VSCode workspace rooted in a directory that
defines a CUE module (i.e. contains
cue.mod/module.cue
).
- Verify that for a valid workspace the extension sees and responds
to runtime configuration changes, and that
cue lsp
is started/stopped according to the resulting configuration, including updating the version number in the status bar. - In a folder/workspace with zero config, and ensuring that we have no global
config set for the extension (i.e. we rely on defaults), open a CUE file to
start the LSP (which will rely on
cmd/cue
inPATH
) and ensure that we usecue
fromPATH
, and ensure we see the:zap:
icon in the status bar. - Similarly, in a valid workspace where we have a configuration setting for
cueCommand
as a valid value, ensure that the LSP runs and that we see the:zap:
icon in the status bar. - Ensure that in a valid workspace we are able to format a
.cue
file via the right-click menu.
- Ensuring that we get an error message when opening a CUE file in untitled
workspace mode (see comment 'Extension instances and configuration'). This is
easiest achieved by closing any existing workspace/folder, and opening a single
.cue
file anywhere. - Ensuring that we get an error message when trying to start the LSP via the
command, but in a configuration state of
useLanguageServer: false
. - Ensuring we get an error message when the
cmd/cue
version used does not support the LSP (as determined bycue help lsp
returning an error). e.g. by using v0.10.0. - Ensuring we get an error when the configured
cueCommand
is a non-simple relative path, e.g../cue
. - With an absolute
cueCommand
value that points to a non-existent path, ensure that we get an error shown to the user. - With an empty
cueCommand
value, ensure we get shown an error message.