diff options
| author | Tommaso Sciortino <[email protected]> | 2025-08-12 15:57:27 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-12 22:57:27 +0000 |
| commit | 9d023be1d16a6bf7427569f863e6cfd2c3442d8b (patch) | |
| tree | b983227f56fd9f26008b475061a345b61207c970 /integration-tests/test-helper.ts | |
| parent | 8d6eb8c322890b5cdf20d4a30dd17afb1541f5aa (diff) | |
Upgrade integration tests to use Vitest (#6021)
Diffstat (limited to 'integration-tests/test-helper.ts')
| -rw-r--r-- | integration-tests/test-helper.ts | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 33443aaf..ac7fec6f 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -10,7 +10,7 @@ import { mkdirSync, writeFileSync, readFileSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; import { env } from 'process'; -import { fileExists } from '../scripts/telemetry_utils.js'; +import fs from 'fs'; const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -297,15 +297,12 @@ export class TestRig { } readFile(fileName: string) { - const content = readFileSync(join(this.testDir!, fileName), 'utf-8'); + const filePath = join(this.testDir!, fileName); + const content = readFileSync(filePath, 'utf-8'); if (env.KEEP_OUTPUT === 'true' || env.VERBOSE === 'true') { - const testId = `${env.TEST_FILE_NAME!.replace( - '.test.js', - '', - )}:${this.testName!.replace(/ /g, '-')}`; - console.log(`--- FILE: ${testId}/${fileName} ---`); + console.log(`--- FILE: ${filePath} ---`); console.log(content); - console.log(`--- END FILE: ${testId}/${fileName} ---`); + console.log(`--- END FILE: ${filePath} ---`); } return content; } @@ -336,7 +333,7 @@ export class TestRig { // Wait for telemetry file to exist and have content await this.poll( () => { - if (!fileExists(logFilePath)) return false; + if (!fs.existsSync(logFilePath)) return false; try { const content = readFileSync(logFilePath, 'utf-8'); // Check if file has meaningful content (at least one complete JSON object) @@ -547,7 +544,7 @@ export class TestRig { // Try reading from file first const logFilePath = join(this.testDir!, 'telemetry.log'); - if (fileExists(logFilePath)) { + if (fs.existsSync(logFilePath)) { try { const content = readFileSync(logFilePath, 'utf-8'); if (content && content.includes('"event.name"')) { @@ -581,7 +578,7 @@ export class TestRig { } // Check if file exists, if not return empty array (file might not be created yet) - if (!fileExists(logFilePath)) { + if (!fs.existsSync(logFilePath)) { return []; } |
