env0 Extension for Visual Studio Code
Unleash the power of env0 directly from your Visual Studio Code workspace! The env0 extension allows seamless interaction with your env0 environments, making your development process smoother and more efficient.
Before using this extension, make sure you meet the following prerequisites:
🔗 Learn how to generate API keys.
🔑 Login and Logout
To login or logout, simply use the
🌳 Environments View
Focused Environments View: The environments view is designed to show you only the environments that are specifically associated with the current branch you're working on, keeping your workflow clean and focused.
Unassociated Environments: Although env0 allows environments to be created without specifying a branch (automatically associating them with the default branch), such environments are not displayed in the environments view even if you switch to the default branch.
API Key & Organizations: If you're using a personal API key and your account is associated with multiple organizations, the extension will default to a single organization and won't provide an option to select others.
🛠 Setting Up Your Local Development for Contributing
A new VS Code window will now launch, serving as your testing ground for the extension.
Quick Tips for Development
To refresh your debug window without closing it:
⚠️ Note: Some modifications may necessitate the complete closure of the Debugging IDE.
Running the Tests
Execute the following command in your terminal to run the integration tests:
For debugging, go to the "Run and Debug" panel in VS Code and select "Extension Test."
The VS Code API presents some unique challenges, such as not being able to read the content of notification messages or the VS Code output channel. To navigate these challenges, we use jest-mock to stub these functions, allowing us to verify that our code is behaving correctly during tests.
Moreover, we import the compiled dist extension file into our test setup. This enables us to run specific functions that are part of the extension, such as resetting its state after each test or ensuring that the Tree View displays the appropriate messages.
Running the Tests
To run the integration tests, execute the following command in your terminal:
Our unit tests are designed to verify the following functionalities:
Important Note on Imports
When working with the tests, it is imperative to import the
The unit tests are executed on the source TypeScript files, not on the compiled files. We have integrated
📚 Recommended Reading
We recommend familiarizing yourself with the following resources: