Skip to content

Commit d050f5b

Browse files
georgeglarsonclaude
andcommitted
fix: graceful test skipping, new unit tests, ESLint/package config improvements
- Migrate 9 integration tests to describeWithEnvironmentCheck() for graceful skipping instead of throwing errors when API keys are missing - Add 178 new unit tests: event-manager (25), error types (84), error factory (35), sanitizer (34) — total now 998 passing - Add "type": "module" to package.json (eliminates Node.js warning) - Relax ESLint rules for test files (no-explicit-any, no-non-null-assertion, no-unused-vars off in *.test.ts and __integration__) - Fix collectStream timeout promise leak (clearTimeout on success) - Zero ESLint warnings, zero test failures, zero type errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a630747 commit d050f5b

17 files changed

Lines changed: 1350 additions & 96 deletions

venice-ai-sdk/packages/core/eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ export default [
2727
'@typescript-eslint/no-non-null-assertion': 'warn'
2828
}
2929
},
30+
{
31+
files: ['**/*.test.ts', '**/__integration__/**'],
32+
rules: {
33+
'@typescript-eslint/no-explicit-any': 'off',
34+
'@typescript-eslint/no-non-null-assertion': 'off',
35+
'@typescript-eslint/no-unused-vars': 'off',
36+
},
37+
},
3038
{
3139
ignores: ['dist/**', 'node_modules/**', '*.config.js', '*.config.ts']
3240
}

venice-ai-sdk/packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@venice-dev-tools/core",
33
"version": "2025.12.4",
4+
"type": "module",
45
"description": "Core package for the Venice AI unOfficial SDK",
56
"main": "./dist/index.cjs",
67
"module": "./dist/index.mjs",

venice-ai-sdk/packages/core/src/__integration__/api-keys.integration.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
1+
import { it, expect, beforeAll, afterAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('API Keys Integration Tests', () => {
5+
describeWithEnvironmentCheck('API Keys Integration Tests', () => {
66
let venice: VeniceAI;
77
let createdKeyId: string;
88
let testApiKey: string;
99
let hasAdminPermissions = false;
1010

1111
beforeAll(async () => {
12-
// Check environment first
13-
const env = checkTestEnvironment(true); // require admin key
14-
if (env.skipTests) {
15-
throw new Error(env.skipReason);
16-
}
17-
1812
const config = getTestConfig();
1913
venice = new VeniceAI({
2014
apiKey: config.adminApiKey!,
@@ -310,4 +304,4 @@ describe('API Keys Integration Tests', () => {
310304
console.error('Error during cleanup:', error);
311305
}
312306
});
313-
});
307+
}, true);

venice-ai-sdk/packages/core/src/__integration__/audio.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Audio Integration Tests', () => {
5+
describeWithEnvironmentCheck('Audio Integration Tests', () => {
66
let venice: VeniceAI;
77

88
beforeAll(() => {
9-
// Check environment first
10-
const env = checkTestEnvironment(false); // require regular API key
11-
if (env.skipTests) {
12-
throw new Error(env.skipReason);
13-
}
14-
159
const config = getTestConfig();
1610
venice = new VeniceAI({
1711
apiKey: config.apiKey!,

venice-ai-sdk/packages/core/src/__integration__/billing.integration.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Billing Integration Tests', () => {
5+
describeWithEnvironmentCheck('Billing Integration Tests', () => {
66
let venice: VeniceAI;
77
let hasAdminPermissions = false;
88

99
beforeAll(async () => {
10-
// Check environment first
11-
const env = checkTestEnvironment(true); // require admin key
12-
if (env.skipTests) {
13-
throw new Error(env.skipReason);
14-
}
15-
1610
const config = getTestConfig();
1711
venice = new VeniceAI({
1812
apiKey: config.adminApiKey!,
@@ -372,4 +366,4 @@ describe('Billing Integration Tests', () => {
372366
venice.billing.getUsage({ limit: 1000 }) // Exceeds max limit
373367
).rejects.toThrow();
374368
}, 30000);
375-
});
369+
}, true);

venice-ai-sdk/packages/core/src/__integration__/characters.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Characters Integration Tests', () => {
5+
describeWithEnvironmentCheck('Characters Integration Tests', () => {
66
let venice: VeniceAI;
77

88
beforeAll(() => {
9-
// Check environment first
10-
const env = checkTestEnvironment(false); // require regular API key
11-
if (env.skipTests) {
12-
throw new Error(env.skipReason);
13-
}
14-
159
const config = getTestConfig();
1610
venice = new VeniceAI({
1711
apiKey: config.apiKey!,

venice-ai-sdk/packages/core/src/__integration__/chat.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Chat Integration Tests', () => {
5+
describeWithEnvironmentCheck('Chat Integration Tests', () => {
66
let venice: VeniceAI;
77

88
beforeAll(() => {
9-
// Check environment first
10-
const env = checkTestEnvironment(false); // require regular API key
11-
if (env.skipTests) {
12-
throw new Error(env.skipReason);
13-
}
14-
159
const config = getTestConfig();
1610
venice = new VeniceAI({
1711
apiKey: config.apiKey!,

venice-ai-sdk/packages/core/src/__integration__/embeddings.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Embeddings Integration Tests', () => {
5+
describeWithEnvironmentCheck('Embeddings Integration Tests', () => {
66
let venice: VeniceAI;
77

88
beforeAll(() => {
9-
// Check environment first
10-
const env = checkTestEnvironment(false); // require regular API key
11-
if (env.skipTests) {
12-
throw new Error(env.skipReason);
13-
}
14-
159
const config = getTestConfig();
1610
venice = new VeniceAI({
1711
apiKey: config.apiKey!,

venice-ai-sdk/packages/core/src/__integration__/error-handling.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44

5-
describe('Error Handling Integration Tests', () => {
5+
describeWithEnvironmentCheck('Error Handling Integration Tests', () => {
66
let venice: VeniceAI;
77

88
beforeAll(() => {
9-
// Check environment first
10-
const env = checkTestEnvironment(false); // require regular API key
11-
if (env.skipTests) {
12-
throw new Error(env.skipReason);
13-
}
14-
159
const config = getTestConfig();
1610
venice = new VeniceAI({
1711
apiKey: config.apiKey!,

venice-ai-sdk/packages/core/src/__integration__/images.integration.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
import { describe, it, expect, beforeAll } from 'vitest';
1+
import { it, expect, beforeAll } from 'vitest';
22
import { VeniceAI } from '../venice-ai';
3-
import { getTestConfig, checkTestEnvironment } from './test-config';
3+
import { getTestConfig, describeWithEnvironmentCheck } from './test-config';
44
import fs from 'fs';
55
import path from 'path';
66

7-
describe('Images Integration Tests', () => {
7+
describeWithEnvironmentCheck('Images Integration Tests', () => {
88
let venice: VeniceAI;
99
let testImageBuffer: Buffer;
1010

1111
beforeAll(async () => {
12-
// Check environment first
13-
const env = checkTestEnvironment(false); // require regular API key
14-
if (env.skipTests) {
15-
throw new Error(env.skipReason);
16-
}
17-
1812
const config = getTestConfig();
1913
venice = new VeniceAI({
2014
apiKey: config.apiKey!,

0 commit comments

Comments
 (0)