Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
code-asher merged 16 commits intomainfromjaggederest/integration_tests
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
7e1bce9
pretest working
jaggederestJun 16, 2025
c693a46
enable vscode-test and bump tsconfig to modern settings
jaggederestJun 16, 2025
240b649
Merge branch 'main' into jaggederest/integration_tests
jaggederestJun 16, 2025
0e58a31
test: fix integration tests to run without Remote SSH extension
jaggederestJun 16, 2025
872b7e8
Merge remote-tracking branch 'origin/jaggederest/integration_tests' i…
jaggederestJun 16, 2025
01c2d80
autocorrect formatting
jaggederestJun 16, 2025
8ddbf26
bump node version to 22
jaggederestJun 16, 2025
9b74df4
fix: configure Vitest to properly exclude VS Code integration tests
jaggederestJun 16, 2025
adec211
whitespace
jaggederestJun 16, 2025
d9b543a
fix: update tsconfig.json and convert pretty-bytes imports to standar…
jaggederestJun 17, 2025
a7afdd6
Remove testmode flag in favor of checking existence of remote ssh ext…
jaggederestJun 17, 2025
3097d8f
remove superfluous async, enable lint rule
jaggederestJun 18, 2025
a2d2bc8
fix: resolve ESLint @typescript-eslint/require-await errors
jaggederestJun 18, 2025
32dfda4
Update configurations and remove pointless Promise.all
jaggederestJun 18, 2025
12b0124
Tweak eslint config to better handle json/md, remove compile-tests sc…
jaggederestJun 18, 2025
3ee92fe
remove extraneous async/await
jaggederestJun 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions.eslintignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
vitest.config.ts
15 changes: 14 additions & 1 deletion.eslintrc.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,8 @@
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
Expand All@@ -15,6 +16,18 @@
"prettier"
],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"require-await": "off",
"@typescript-eslint/require-await": "error"
}
},
{
"extends": ["plugin:package-json/legacy-recommended"],
"files": ["*.json"],
"parser": "jsonc-eslint-parser"
},
{
"files": ["*.md"],
"parser": "markdown-eslint-parser"
Expand Down
4 changes: 2 additions & 2 deletions.github/workflows/ci.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"

- run: yarn

Expand All@@ -36,7 +36,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"

- run: yarn

Expand Down
2 changes: 1 addition & 1 deletion.github/workflows/release.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "22"

- run: yarn

Expand Down
12 changes: 12 additions & 0 deletions.vscode-test.mjs
View file
Open in desktop
Original file line numberDiff line numberDiff 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,
},
});
2 changes: 1 addition & 1 deletion.vscodeignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,4 +12,4 @@ node_modules/**
**/.editorconfig
**/*.map
**/*.ts
*.gif
*.gif
1 change: 1 addition & 0 deletionsCLAUDE.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@
- Run all tests: `yarn test`
- Run specific test: `vitest ./src/filename.test.ts`
- CI test mode: `yarn test:ci`
- Integration tests: `yarn test:integration`

## Code Style Guidelines

Expand Down
126 changes: 67 additions & 59 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
{
"name": "coder-remote",
"publisher": "coder",
"displayName": "Coder",
"description": "Open any workspace with a single click.",
"repository": "https://github.com/coder/vscode-coder",
"version": "1.9.1",
"engines":{
"vscode":"^1.73.0"
},
"license": "MIT",
"description":"Open any workspace with a single click.",
"categories":[
"Other"
],
"bugs": {
"url": "https://github.com/coder/vscode-coder/issues"
},
"icon": "media/logo.png",
"extensionKind": [
"ui"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
}
"repository": {
"type": "git",
"url": "https://github.com/coder/vscode-coder"
},
"categories": [
"Other"
],
"extensionPack": [
"ms-vscode-remote.remote-ssh"
],
"activationEvents": [
"onResolveRemoteAuthority:ssh-remote",
"onCommand:coder.connect",
"onUri"
],
"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",
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The 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 👍

code-asher reacted with thumbs up emoji
"test": "vitest",
"test:ci": "CI=true yarn test",
"test:integration": "vscode-test",
"vscode:prepublish": "yarn package",
"watch": "webpack --watch"
},
"contributes": {
"configuration": {
"title": "Coder",
Expand All@@ -45,8 +43,7 @@
"type": "string",
"pattern": "^[a-zA-Z0-9-]+[=\\s].*$"
},
"scope": "machine",
"default": []
"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.",
Expand DownExpand Up@@ -269,17 +266,30 @@
]
}
},
"scripts": {
"vscode:prepublish": "yarn package",
"build": "webpack",
"watch": "webpack --watch",
"fmt": "prettier --write .",
"package": "webpack --mode production --devtool hidden-source-map",
"package:prerelease": "npx vsce package --pre-release",
"lint": "eslint . --ext ts,md",
"lint:fix": "yarn lint --fix",
"test": "vitest ./src",
"test:ci": "CI=true yarn test"
"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",
Expand All@@ -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",
Expand All@@ -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",
Expand All@@ -313,25 +326,20 @@
"webpack": "^5.99.6",
"webpack-cli": "^5.1.4"
},
"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.1"
},
"resolutions": {
"semver": "7.7.1",
"trim": "0.0.3",
"word-wrap": "1.2.5"
"extensionPack": [
"ms-vscode-remote.remote-ssh"
],
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"engines": {
"vscode": "^1.73.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"icon": "media/logo.png",
"extensionKind": [
"ui"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
}
}
}
4 changes: 2 additions & 2 deletionssrc/api.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,11 +71,11 @@ export async function createHttpAgent(): Promise<ProxyAgent> {
* configuration. The token may be undefined if some other form of
* authentication is being used.
*/
exportasyncfunction makeCoderSdk(
export function makeCoderSdk(
baseUrl: string,
token: string | undefined,
storage: Storage,
):Promise<Api> {
): Api {
const restClient = new Api();
restClient.setHost(baseUrl);
if (token) {
Expand Down
2 changes: 1 addition & 1 deletionsrc/error.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,7 +126,7 @@ export class CertificateError extends Error {
}

// allowInsecure updates the value of the "coder.insecure" property.
asyncallowInsecure():Promise<void> {
allowInsecure(): void {
vscode.workspace
.getConfiguration()
.update("coder.insecure", true, vscode.ConfigurationTarget.Global);
Expand Down
34 changes: 23 additions & 11 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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, cannot activate Coder extension",
"Remote SSH extension not found, this may not work as expected.\n" +
// NB should we link to documentation or marketplace?
"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
Copy link
Preview

CopilotAIJun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Using 'module as any' bypasses type safety; consider a more type-safe approach or adding documentation to justify this workaround.

Copilot uses AI. Check for mistakes.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah I get it buddy I don't like it either but we're polymorphic on the SSH extensions.

code-asher reacted with laugh emoji
throw new Error("Remote SSH extension not found");
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const vscodeProposed: typeof vscode = (module as any)._load(
"vscode",
{
filename: remoteSSHExtension?.extensionPath,
},
false,
);

const output = vscode.window.createOutputChannel("Coder");
const storage = new Storage(
Expand DownExpand Up@@ -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.
if (vscodeProposed.env.remoteAuthority) {
//
// 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)
if (remoteSSHExtension && vscodeProposed.env.remoteAuthority) {
const remote = new Remote(
vscodeProposed,
storage,
Expand Down
56 changes: 56 additions & 0 deletionssrc/test/extension.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
import * as assert from "assert";
import * as vscode from "vscode";

suite("Extension Test Suite", () => {
vscode.window.showInformationMessage("Start all tests.");

test("Extension should be present", () => {
assert.ok(vscode.extensions.getExtension("coder.coder-remote"));
});

test("Extension should activate", async () => {
const extension = vscode.extensions.getExtension("coder.coder-remote");
assert.ok(extension);

if (!extension.isActive) {
await extension.activate();
}

assert.ok(extension.isActive);
});

test("Extension should export activate function", async () => {
const extension = vscode.extensions.getExtension("coder.coder-remote");
assert.ok(extension);

await extension.activate();
// The extension doesn't export anything, which is fine
// The test was expecting exports.activate but the extension
// itself is the activate function
assert.ok(extension.isActive);
});

test("Commands should be registered", async () => {
const extension = vscode.extensions.getExtension("coder.coder-remote");
assert.ok(extension);

if (!extension.isActive) {
await extension.activate();
}

// Give a small delay for commands to register
await new Promise((resolve) => setTimeout(resolve, 100));

const commands = await vscode.commands.getCommands(true);
const coderCommands = commands.filter((cmd) => cmd.startsWith("coder."));

assert.ok(
coderCommands.length > 0,
"Should have registered Coder commands",
);
assert.ok(
coderCommands.includes("coder.login"),
"Should have coder.login command",
);
});
});
Loading

[8]ページ先頭

©2009-2025 Movatter.jp