- Notifications
You must be signed in to change notification settings - Fork35
Add package scripts and cli library, enable integration testing#536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from15 commits
7e1bce9c693a46240b6490e58a31872b7e801c2d808ddbf269b74df4adec211d9b543aa7afdd63097d8fa2d2bc832dfda412b01243ee92feFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| vitest.config.ts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -18,7 +18,7 @@ jobs: | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
| - run: yarn | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { defineConfig } from "@vscode/test-cli"; | ||
| export default defineConfig({ | ||
| files: "out/test/**/*.test.js", | ||
| extensionDevelopmentPath: ".", | ||
| extensionTestsPath: "./out/test", | ||
| launchArgs: ["--enable-proposed-api", "coder.coder-remote"], | ||
| mocha: { | ||
| ui: "tdd", | ||
| timeout: 20000, | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,4 +12,4 @@ node_modules/** | ||
| **/.editorconfig | ||
| **/*.map | ||
| **/*.ts | ||
| *.gif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,36 @@ | ||
| { | ||
| "name":"coder-remote", | ||
| "displayName":"Coder", | ||
| "version":"1.9.1", | ||
| "description":"Open any workspace with a single click.", | ||
| "categories":[ | ||
| "Other" | ||
| ], | ||
| "bugs": { | ||
| "url":"https://github.com/coder/vscode-coder/issues" | ||
| }, | ||
| "repository": { | ||
| "type":"git", | ||
| "url":"https://github.com/coder/vscode-coder" | ||
| }, | ||
| "license":"MIT", | ||
| "publisher":"coder", | ||
| "type":"commonjs", | ||
| "main":"./dist/extension.js", | ||
| "scripts": { | ||
| "build":"webpack", | ||
| "fmt":"prettier --write .", | ||
| "lint":"eslint . --ext ts,md,json", | ||
| "lint:fix":"yarn lint --fix", | ||
| "package":"webpack --mode production --devtool hidden-source-map", | ||
| "package:prerelease":"npx vsce package --pre-release", | ||
| "pretest":"tsc -p . --outDir out && yarn run build && yarn run lint", | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Do we have to compile separately from Webpack because vscode-test requires that or something? Is there a reason it cannot use the Webpack bundle? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm not sure, I'll see if I can ditch it in my next PR 👍 | ||
| "test":"vitest", | ||
| "test:ci":"CI=true yarn test", | ||
| "test:integration":"vscode-test", | ||
| "vscode:prepublish":"yarn package", | ||
| "watch":"webpack --watch" | ||
| }, | ||
| "contributes": { | ||
| "configuration": { | ||
| "title":"Coder", | ||
| @@ -45,8 +43,7 @@ | ||
| "type":"string", | ||
| "pattern":"^[a-zA-Z0-9-]+[=\\s].*$" | ||
| }, | ||
| "scope":"machine" | ||
| }, | ||
| "coder.insecure": { | ||
| "markdownDescription":"If true, the extension will not verify the authenticity of the remote host. This is useful for self-signed certificates.", | ||
| @@ -269,17 +266,30 @@ | ||
| ] | ||
| } | ||
| }, | ||
| "activationEvents": [ | ||
| "onResolveRemoteAuthority:ssh-remote", | ||
| "onCommand:coder.connect", | ||
| "onUri" | ||
| ], | ||
| "resolutions": { | ||
| "semver":"7.7.1", | ||
| "trim":"0.0.3", | ||
| "word-wrap":"1.2.5" | ||
| }, | ||
| "dependencies": { | ||
| "axios":"1.8.4", | ||
| "date-fns":"^3.6.0", | ||
| "eventsource":"^3.0.6", | ||
| "find-process":"https://github.com/coder/find-process#fix/sequoia-compat", | ||
| "jsonc-parser":"^3.3.1", | ||
| "memfs":"^4.17.1", | ||
| "node-forge":"^1.3.1", | ||
| "pretty-bytes":"^6.1.1", | ||
| "proxy-agent":"^6.4.0", | ||
| "semver":"^7.7.1", | ||
| "ua-parser-js":"1.0.40", | ||
| "ws":"^8.18.2", | ||
| "zod":"^3.25.65" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/eventsource":"^3.0.0", | ||
| @@ -291,6 +301,7 @@ | ||
| "@types/ws":"^8.18.1", | ||
| "@typescript-eslint/eslint-plugin":"^7.0.0", | ||
| "@typescript-eslint/parser":"^6.21.0", | ||
| "@vscode/test-cli":"^0.0.10", | ||
| "@vscode/test-electron":"^2.5.2", | ||
| "@vscode/vsce":"^2.21.1", | ||
| "bufferutil":"^4.0.9", | ||
| @@ -300,8 +311,10 @@ | ||
| "eslint-config-prettier":"^9.1.0", | ||
| "eslint-plugin-import":"^2.31.0", | ||
| "eslint-plugin-md":"^1.0.19", | ||
| "eslint-plugin-package-json":"^0.40.1", | ||
| "eslint-plugin-prettier":"^5.4.1", | ||
| "glob":"^10.4.2", | ||
| "jsonc-eslint-parser":"^2.4.0", | ||
| "nyc":"^17.1.0", | ||
| "prettier":"^3.5.3", | ||
| "ts-loader":"^9.5.1", | ||
| @@ -313,25 +326,20 @@ | ||
| "webpack":"^5.99.6", | ||
| "webpack-cli":"^5.1.4" | ||
| }, | ||
| "extensionPack": [ | ||
| "ms-vscode-remote.remote-ssh" | ||
| ], | ||
| "packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", | ||
| "engines": { | ||
| "vscode":"^1.73.0" | ||
| }, | ||
| "icon":"media/logo.png", | ||
| "extensionKind": [ | ||
| "ui" | ||
| ], | ||
| "capabilities": { | ||
| "untrustedWorkspaces": { | ||
| "supported":true | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,25 +21,31 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> { | ||
| // | ||
| // Cursor and VSCode are covered by ms remote, and the only other is windsurf for now | ||
| // Means that vscodium is not supported by this for now | ||
| const remoteSSHExtension = | ||
| vscode.extensions.getExtension("jeanp413.open-remote-ssh") || | ||
| vscode.extensions.getExtension("codeium.windsurf-remote-openssh") || | ||
| vscode.extensions.getExtension("anysphere.remote-ssh") || | ||
| vscode.extensions.getExtension("ms-vscode-remote.remote-ssh"); | ||
| let vscodeProposed: typeof vscode = vscode; | ||
| if (!remoteSSHExtension) { | ||
| vscode.window.showErrorMessage( | ||
| "Remote SSH extension not found, this may not work as expected.\n" + | ||
| // NB should we link to documentation or marketplace? | ||
jaggederest marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| "Please install your choice of Remote SSH extension from the VS Code Marketplace.", | ||
| ); | ||
| } else { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| vscodeProposed = (module as any)._load( | ||
| "vscode", | ||
| { | ||
| filename: remoteSSHExtension.extensionPath, | ||
| }, | ||
| false, | ||
| ); | ||
Comment on lines +40 to 47 CopilotAI | ||
| } | ||
| const output = vscode.window.createOutputChannel("Coder"); | ||
| const storage = new Storage( | ||
| @@ -278,7 +284,13 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> { | ||
| // Since the "onResolveRemoteAuthority:ssh-remote" activation event exists | ||
| // in package.json we're able to perform actions before the authority is | ||
| // resolved by the remote SSH extension. | ||
| // | ||
| // In addition, if we don't have a remote SSH extension, we skip this | ||
| // activation event. This may allow the user to install the extension | ||
| // after the Coder extension is installed, instead of throwing a fatal error | ||
| // (this would require the user to uninstall the Coder extension and | ||
| // reinstall after installing the remote SSH extension, which is annoying) | ||
code-asher marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| if (remoteSSHExtension && vscodeProposed.env.remoteAuthority) { | ||
| const remote = new Remote( | ||
| vscodeProposed, | ||
| storage, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -910,9 +910,9 @@ export class Remote { | ||
| .then((content) => { | ||
| return JSON.parse(content); | ||
| }) | ||
| .then(async(parsed) => { | ||
| try { | ||
| awaitupdateStatus(parsed); | ||
jaggederest marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } catch (ex) { | ||
| // Ignore | ||
| } | ||
Uh oh!
There was an error while loading.Please reload this page.