Unit tests are configured to run via vitest
. To run them:
npm run test
End-to-end tests are configured to run via wdio-vscode-service
. This allows
testing workflows and has better abstractions for ui testing than @vscode/test-electron
.
See wdio-vscode-service for more details.
To run end-to-end tests:
npm run test:e2e
To run using VS Code
debugger:
-
Set a breakpoint in a test
-
Either
Enable auto attach with flag (
Command palette -> Debug: Toggle Auto Attach -> Only With Flag
).Note you may need to open a new terminal for this to take effect.
or
Open
Javascript Debug Terminal
(Click the dropdown arrow beside the + button for adding a new terminal) -
Run the script:
npm run test:e2e
-
You should see the tests start and
VS Code
stop at the breakpoint.
vsce, short for "Visual Studio Code Extensions", is a command-line tool for packaging, publishing and managing VS Code
extensions. The Deephaven extension calls vsce
via npm scripts. Note that vsce package
and vsce publish
both call the vscode:prepublish
script.
This extension can also be installed directly from a .vsix
. To get a .vsix
, you can either:
Download one from the releases/ folder.
or
Build a .vsix locally via npm run package:latest
(see VSCE section)
Publishing a VS Code
extension requires:
- Azure AD organization - https://dev.azure.com/deephaven-oss/
- Marketplace publisher - https://marketplace.visualstudio.com/publishers/deephaven
- Personal access token - associated with a user in the Azure AD organization
NOTE: This can be set in
VSCE_PAT
env variable
We are following the official VS Code
extension publishing guidance.
- Pre-release versions use
major.ODD_NUMBER.patch
version scheme (e.g.1.1.3
) - Release versions use
major.EVEN_NUMBER.patch
versions scheme (e.g.1.2.3
)
Note that
VS Code
will always install a later release version instead of pre-release, so it's important to always have a pre-release version that is later than the release version if we want to allow pre-release users to stay on the latest pre-release.
You can find additional details here: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions
See versioning strategy for details on our version number scheme.
- Verify the contents of the package will be what you expect:
npx vsce ls
- If new content has been added that is not included in the output, you may need to tweak the
.vscodeignore
, to make sure it is included (this should not be common). - Optionally run
npm run package:latest
if you want to locally install a.vsix
for testing before publishing.
- Make sure you are in a clean branch whose HEAD points to the commit to publish.
- Make sure you are logged in with
vsce
using a personal access token for a user in the https://dev.azure.com/deephaven-oss/ org.npx vsce login deephaven
- Run
npm run publish:prerelease
Logo .pngs were generated from .svgs using rsvg-convert
rsvg-convert -w 128 -h 128 images/dh-community-on-dark-128.svg -o images/dh-community-on-dark-128.png
rsvg-convert -w 128 -h 128 images/dh-community-on-light-128.svg -o images/dh-community-on-light-128.png
The extension uses an icon font generated from SVGs in @deephaven/icons
. Running the generator requires a local checkout of web-client-ui.
The generator can be run via the following script, where <path-to-dh-icons-directory>
is the location of packages/icons/src/icons
in web-client-ui
.
npm run icon:gen -- <path-to-dh-icons-directory>
The script will automatically copy icons/dist/dh-icons.woff2
file to the /assets
folder of the extension, but the contents of icons/dist/dh-contributes-icons.json
has to be manually copied to the package.json
contributes/icons
section.
Note: All of the icons should be consumed via the
dh-xxx
icon ids, so no code changes should be necessary unless icons have been renamed or removed.
The first time a connection is made to a DHC
server, the extension will:
- Download the JS API from the server
- Check server auth config. If anonymous, connect anonymously. If
PSK
prompt forPSK
.
If auth succeeds and connection was initiated by running a script:
- Run the script against the server
- Update panels in
VS Code
and deephaven.
On subsequent script runs, the session will be re-used and only steps 4 and 5 will run
The extension dynamically downloads and loads the DH JS API from a running DH Core server. At runtime, dh-internal.js
and dh-core.js
are downloaded from the running DH server (default http://localhost:10000). The files are saved to out/util/tmp
as .cjs
modules, and import / export are converted to cjs compatible ones. For implementation details, see src/dh/dhc.ts#getDhc.