-
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 lspis 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/cueinPATH) and ensure that we usecuefromPATH, and ensure we see the:zap:icon in the status bar. - Similarly, in a valid workspace where we have a configuration setting for
cueCommandas 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
.cuefile 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
.cuefile 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/cueversion used does not support the LSP (as determined bycue help lspreturning an error). e.g. by using v0.10.0. - Ensuring we get an error when the configured
cueCommandis a non-simple relative path, e.g../cue. - With an absolute
cueCommandvalue that points to a non-existent path, ensure that we get an error shown to the user. - With an empty
cueCommandvalue, ensure we get shown an error message.