Skip to content

Commit

Permalink
do the thing
Browse files Browse the repository at this point in the history
  • Loading branch information
jpogran committed Nov 14, 2024
1 parent b405256 commit 3a4abcb
Show file tree
Hide file tree
Showing 36 changed files with 1,073 additions and 336 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/INTERNAL-20241105-111825.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: INTERNAL
body: Migrate to redhat-ext-tester
time: 2024-11-05T11:18:25.988501-05:00
custom:
Issue: "1873"
Repository: vscode-terraform
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
- ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
VSCODE_VERSION: ${{ matrix.vscode }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -72,3 +74,9 @@ jobs:
- name: Run Tests
run: npm test
if: runner.os != 'Linux'
- name: Run UI Tests
run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run test:ui
if: runner.os == 'Linux'
- name: Run UI Tests
run: npm run test:ui
if: runner.os != 'Linux'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.terraform
.vscode-test
.vscode-test-web
.test-storage
.test-extensions
*.vsix
bin
Expand Down
4 changes: 0 additions & 4 deletions .mocharc.js

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode-test
.vscode-test-web
.wdio-vscode-service
.test-storage
language-configuration.json
node_modules
dist
Expand Down
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionDevelopmentKind=web"],
"outFiles": ["${workspaceFolder}/dist/web/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
"name": "Debug UI Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/extest",
"windows": {
"program": "${workspaceFolder}/node_modules/vscode-extension-tester/out/cli.js"
},
"args": [
"setup-and-run",
"${workspaceFolder}/out/test/e2e/specs/**/*.e2e.js",
"--code_settings",
"${workspaceFolder}/src/test/e2e/settings.json",
"--extensions_dir",
".test-extensions",
"--mocha_config",
"${workspaceFolder}/src/test/e2e/.mocharc.js",
"--uninstall_extension",
"--log_level",
"debug",
"--storage",
".test-storage"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
6 changes: 6 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.mocharc.js
esbuild.mjs
eslint.config.mjs
uitest.mjs
.changes
.changie.yaml
.copywrite.hcl
Expand All @@ -16,6 +20,7 @@
.vscode-test.mjs
.vscodeignore
.wdio-vscode-service
.test-storage
**/__mocks__
build/
DEVELOPMENT.md
Expand All @@ -26,3 +31,4 @@ src/
out/
esbuild.js
tsconfig.json
.test-extensions
8 changes: 5 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ export default [
semi: 'warn',
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
Expand All @@ -64,6 +65,7 @@ export default [
ignores: [
'.vscode-test',
'.wdio-vscode-service',
'.test-storage',
'dist',
'out',
'src/test',
Expand Down
46 changes: 45 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@
"title": "HCP Terraform: Login",
"enablement": "terraform.cloud.signed-in === false"
},
{
"command": "terraform.cloud.logout",
"title": "HCP Terraform: Logout",
"enablement": "terraform.cloud.signed-in === true"
},
{
"command": "terraform.cloud.workspaces.refresh",
"title": "Refresh",
Expand Down Expand Up @@ -656,6 +661,10 @@
"command": "terraform.cloud.login",
"when": "terraform.cloud.signed-in === false && terraform.cloud.views.visible"
},
{
"command": "terraform.cloud.logout",
"when": "terraform.cloud.signed-in === true && terraform.cloud.views.visible"
},
{
"command": "terraform.cloud.organization.picker",
"when": "terraform.cloud.signed-in"
Expand Down Expand Up @@ -928,7 +937,7 @@
]
},
"scripts": {
"prepare": "npm run download:artifacts && cd src/test/e2e && npm install",
"prepare": "npm run download:artifacts",
"compile": "npm run check-types && npm run lint && node esbuild.mjs",
"compile:prod": "npm run check-types && npm run lint && node esbuild.mjs --production",
"compile:tests": "tsc -p .",
Expand All @@ -947,7 +956,7 @@
"package": "vsce package",
"pretest": "npm run compile:tests && npm run compile && npm run lint",
"test": "vscode-test",
"test:ui": "npm run compile:tests && extest setup-and-run './out/test/e2e/specs/**/*.e2e.js' --code_version max --extensions_dir .test-extensions",
"test:ui": "node uitest.mjs",
"lint": "eslint",
"format": "prettier --write .",
"check-types": "tsc --noEmit",
Expand All @@ -963,7 +972,8 @@
"vscode-languageclient": "^9.0.1",
"vscode-uri": "^3.0.7",
"which": "^3.0.1",
"zod": "^3.21.4"
"zod": "^3.21.4",
"zod-fixture": "^2.5.2"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
Expand Down
4 changes: 3 additions & 1 deletion src/api/terraformCloud/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { makeApi } from '@zodios/core';
import { z } from 'zod';
import { errors } from './errors';

const accountDetails = z.object({
export const accountDetails = z.object({
data: z.object({
id: z.string(),
type: z.string(),
Expand All @@ -18,6 +18,8 @@ const accountDetails = z.object({
}),
});

export type Account = z.infer<typeof accountDetails>;

export const accountEndpoints = makeApi([
{
method: 'get',
Expand Down
7 changes: 4 additions & 3 deletions src/api/terraformCloud/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { paginationMeta, paginationParams } from './pagination';
import { searchQueryParams } from './filter';
import { errors } from './errors';

const organization = z.object({
export const organization = z.object({
id: z.string(),
attributes: z.object({
'external-id': z.string(),
Expand All @@ -19,7 +19,7 @@ const organization = z.object({

export type Organization = z.infer<typeof organization>;

const organizations = z.object({
export const organizations = z.object({
data: z.array(organization),
meta: z
.object({
Expand All @@ -41,7 +41,8 @@ const organizationMemebrship = z.object({
}),
}),
});
const organizationMemberships = z.object({

export const organizationMemberships = z.object({
data: z.array(organizationMemebrship),
});
export type OrganizationMembership = z.infer<typeof organizationMemebrship>;
Expand Down
4 changes: 2 additions & 2 deletions src/api/terraformCloud/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { paginationMeta, paginationParams } from './pagination';
import { searchQueryParams } from './filter';
import { errors } from './errors';

const project = z.object({
export const project = z.object({
id: z.string(),
attributes: z.object({
name: z.string(),
Expand All @@ -18,7 +18,7 @@ const project = z.object({

export type Project = z.infer<typeof project>;

const projects = z.object({
export const projects = z.object({
data: z.array(project),
meta: z.object({
pagination: paginationMeta,
Expand Down
4 changes: 2 additions & 2 deletions src/api/terraformCloud/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const workspaceRelationships = z.object({
project: relationship,
});

const workspace = z.object({
export const workspace = z.object({
id: z.string(),
attributes: workspaceAttributes,
relationships: workspaceRelationships,
Expand All @@ -66,7 +66,7 @@ const workspace = z.object({
export type Workspace = z.infer<typeof workspace>;
export type WorkspaceAttributes = z.infer<typeof workspaceAttributes>;

const workspaces = z.object({
export const workspaces = z.object({
data: z.array(workspace),
meta: z.object({
pagination: paginationMeta,
Expand Down
2 changes: 0 additions & 2 deletions src/commands/generateBugReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,9 @@ Outdated:\t${info.outdated}
const extensions = vscode.extensions.all
.filter((element) => element.packageJSON.isBuiltin === false)
.sort((leftside, rightside): number => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
if (leftside.packageJSON.name.toLowerCase() < rightside.packageJSON.name.toLowerCase()) {
return -1;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
if (leftside.packageJSON.name.toLowerCase() > rightside.packageJSON.name.toLowerCase()) {
return 1;
}
Expand Down
11 changes: 11 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { TerraformLSCommands } from './commands/terraformls';
import { TerraformCommands } from './commands/terraform';
import * as lsStatus from './status/language';
import { TerraformCloudFeature } from './features/terraformCloud';
import { setupMockServer, stopMockServer } from './test/e2e/specs/mocks/server';

const id = 'terraform';
const brand = `HashiCorp Terraform`;
Expand All @@ -55,6 +56,11 @@ let initializationError: ResponseError<InitializeError> | Error | undefined = un
let crashCount = 0;

export async function activate(context: vscode.ExtensionContext): Promise<void> {
// if (config('terraform').get<string>('trace.server') === 'verbose') {
// setupMockServer();
// }
setupMockServer();

const manifest = context.extension.packageJSON;
reporter = new TelemetryReporter(context.extension.id, manifest.version, manifest.appInsightsKey);
context.subscriptions.push(reporter);
Expand Down Expand Up @@ -240,4 +246,9 @@ export async function deactivate(): Promise<void> {
lsStatus.setLanguageServerState(error, false, vscode.LanguageStatusSeverity.Error);
}
}

// if (config('terraform').get<string>('trace.server') === 'verbose') {
// stopMockServer();
// }
stopMockServer();
}
Loading

0 comments on commit 3a4abcb

Please sign in to comment.