Skip to content

Commit 73100f8

Browse files
authored
chore(vscode): lint the tests folder (#4893)
1 parent 92965a8 commit 73100f8

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

vscode/extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@
117117
},
118118
"scripts": {
119119
"ci": "pnpm run lint && pnpm run compile && pnpm run test:unit",
120-
"lint": "eslint src",
121-
"lint:fix": "eslint src --fix",
120+
"lint": "eslint src tests",
121+
"lint:fix": "eslint src tests --fix",
122122
"test:unit": "vitest run",
123123
"code-server": "code-server",
124124
"test:e2e": "pnpm run vscode:package && playwright test",

vscode/extension/tests/extension.setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { execSync } from 'child_process'
33
import path from 'path'
44
import fs from 'fs-extra'
55
import { createHash } from 'crypto'
6+
import { tmpdir } from 'os'
67

78
setup('prepare extension', async () => {
89
console.log('Setting up extension for Playwright tests...')
@@ -32,7 +33,7 @@ setup('prepare extension', async () => {
3233

3334
// Create a temporary user data directory for the installation
3435
const tempUserDataDir = await fs.mkdtemp(
35-
path.join(require('os').tmpdir(), 'vscode-test-install-user-data-'),
36+
path.join(tmpdir(), 'vscode-test-install-user-data-'),
3637
)
3738

3839
try {

vscode/extension/tests/lineage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, Page } from '@playwright/test'
1+
import { test, Page } from '@playwright/test'
22
import path from 'path'
33
import fs from 'fs-extra'
44
import os from 'os'

vscode/extension/tests/python_env.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ async function runTest(page: Page, context: CodeServerContext): Promise<void> {
3838
await openLineageView(page)
3939
}
4040

41-
async function setupEnvironment(): Promise<[string, PythonEnvironment]> {
41+
async function setupEnvironment(): Promise<{
42+
tempDir: string
43+
pythonDetails: PythonEnvironment
44+
}> {
4245
const tempDir = await fs.mkdtemp(
4346
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
4447
)
@@ -61,15 +64,14 @@ async function setupEnvironment(): Promise<[string, PythonEnvironment]> {
6164
await fs.writeJson(path.join(tempDir, '.vscode', 'settings.json'), settings, {
6265
spaces: 2,
6366
})
64-
65-
return [tempDir, pythonDetails]
67+
return { tempDir, pythonDetails }
6668
}
6769

6870
test.describe('python environment variable injection on sqlmesh_lsp', () => {
6971
test('normal setup - error ', async ({ page }, testInfo) => {
7072
testInfo.setTimeout(120_000)
7173

72-
const [tempDir, _] = await setupEnvironment()
74+
const { tempDir } = await setupEnvironment()
7375
writeEnvironmentConfig(tempDir)
7476

7577
const context = await startCodeServer({
@@ -87,7 +89,7 @@ test.describe('python environment variable injection on sqlmesh_lsp', () => {
8789
test('normal setup - set', async ({ page }, testInfo) => {
8890
testInfo.setTimeout(120_000)
8991

90-
const [tempDir, _] = await setupEnvironment()
92+
const { tempDir } = await setupEnvironment()
9193
writeEnvironmentConfig(tempDir)
9294
const env_file = path.join(tempDir, '.env')
9395
fs.writeFileSync(env_file, 'TEST_VAR=test_value')
@@ -131,7 +133,7 @@ test.describe('tcloud version', () => {
131133
test('normal setup - error ', async ({ page }, testInfo) => {
132134
testInfo.setTimeout(120_000)
133135

134-
const [tempDir, pythonDetails] = await setupEnvironment()
136+
const { tempDir, pythonDetails } = await setupEnvironment()
135137
await setupTcloudProject(tempDir, pythonDetails)
136138
writeEnvironmentConfig(tempDir)
137139
const context = await startCodeServer({
@@ -148,7 +150,7 @@ test.describe('tcloud version', () => {
148150
test('normal setup - set', async ({ page }, testInfo) => {
149151
testInfo.setTimeout(120_000)
150152

151-
const [tempDir, pythonDetails] = await setupEnvironment()
153+
const { tempDir, pythonDetails } = await setupEnvironment()
152154
await setupTcloudProject(tempDir, pythonDetails)
153155
writeEnvironmentConfig(tempDir)
154156
const env_file = path.join(tempDir, '.env')

vscode/extension/tests/tcloud.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ test('signed in and not installed shows installation window', async ({
173173
.click()
174174

175175
await page.waitForSelector('text=Installing enterprise python package')
176-
expect(
177-
await page.locator('text=Installing enterprise python package'),
176+
await expect(
177+
page.locator('text=Installing enterprise python package'),
178178
).toHaveCount(2)
179179

180180
await page.waitForSelector('text=Loaded SQLMesh context')

vscode/extension/tests/utils_code_server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ export async function startCodeServer({
105105
reject(new Error('Code-server failed to start within timeout'))
106106
}, 30000)
107107

108-
codeServerProcess.stdout?.on('data', data => {
108+
codeServerProcess.stdout?.on('data', (data: Buffer) => {
109109
output += data.toString()
110110
if (output.includes('HTTP server listening on')) {
111111
clearTimeout(timeout)
112112
resolve()
113113
}
114114
})
115115

116-
codeServerProcess.stderr?.on('data', data => {
116+
codeServerProcess.stderr?.on('data', (data: Buffer) => {
117117
console.error('Code-server stderr:', data.toString())
118118
})
119119

0 commit comments

Comments
 (0)