This folder contains some integration tests for the VS Code Lean 4 extension. These tests follow the examples provided in Testing VS Code Extensions.
The tests launch a new test installed version of VS Code (not your regular VS code) where this test
install lives in a local .vscode-test folder, and it has its own user data in there also. So the
first time you run the tests you will see it download the latest version of VS code into that
folder. It launches this test version with a --extensionDevelopmentPath option pointing to the
vscode-lean4 folder so that the local version of the extension you have build loads into VS code
for testing. All this is setup by the runTests.ts program.
The test folder is organized into:
- suite - for the actual test code.
- test-fixtures - contains Lean sample projects used by the tests.
The following is a description of the tests:
- suite/simple:
Untitled Lean Filetests that the lean4 extension loads correctly for adhoc files, and untitled files, and that the infoview opens and contains the right output, so this is an end-to-end test ensuring the lean language service is running. It also tests that you canGoto Definitionto the Lean source code forLean.versionStringand that this takes you toleanprover--lean4---nightly.Orphaned Lean Filetests we can open a Lean 4 file in a folder that has no inheritedlean-toolchainversion information and that you get thedefaulttoolchain in this case.Goto definition in a package foldertests opening a folder containing a Lean 4 project, and that goto definition works across files in the project.
- suite/toolchains:
Edit lean-toolchain versiontests that when you edit thelean-toolchainfile and specify a different version that the lean server is restarted with that new version.
- suite/multi:
Load a multi-project workspacetests lean4 works in a multi-folder VS code workspace where each folder in the workspace uses a different version of lean. It verifies that two separate LeanClients are running in this case each using the correct version of the Lean toolchain specified in thelean-toolchainin each folder.
To run the tests you must first follow the build steps in ../readme.md.
For these tests to pass on your machine you need to:
- install
leanprover/lean4:nightlytoolchain - install
leanprover/lean4:stabletoolchain - ensure you have a
defaultLean4 toolchain
Now you can run npm run test and you will get some handy console output of the test run.
The first time you run the test this way it will download a test version of vscode
and place it in a temporary folder .vscode-test/.