File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
dev-packages/node-integration-tests/suites/tracing Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import Anthropic from '@anthropic-ai/sdk';
22import * as Sentry from '@sentry/node' ;
33import express from 'express' ;
44
5- const PORT = 3333 ;
6-
75function startMockAnthropicServer ( ) {
86 const app = express ( ) ;
97 app . use ( express . json ( ) ) ;
@@ -50,7 +48,7 @@ function startMockAnthropicServer() {
5048 } ,
5149 } ) ;
5250 } ) ;
53- return app . listen ( PORT ) ;
51+ return app . listen ( ) ;
5452}
5553
5654async function run ( ) {
@@ -59,7 +57,7 @@ async function run() {
5957 await Sentry . startSpan ( { op : 'function' , name : 'main' } , async ( ) => {
6058 const client = new Anthropic ( {
6159 apiKey : 'mock-api-key' ,
62- baseURL : `http://localhost:${ PORT } /anthropic` ,
60+ baseURL : `http://localhost:${ server . address ( ) . port } /anthropic` ,
6361 } ) ;
6462
6563 // First test: basic message completion
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import { GoogleGenAI } from '@google/genai';
22import * as Sentry from '@sentry/node' ;
33import express from 'express' ;
44
5- const PORT = 3333 ;
6-
75function startMockGoogleGenAIServer ( ) {
86 const app = express ( ) ;
97 app . use ( express . json ( ) ) ;
@@ -39,7 +37,7 @@ function startMockGoogleGenAIServer() {
3937 } ) ;
4038 } ) ;
4139
42- return app . listen ( PORT ) ;
40+ return app . listen ( ) ;
4341}
4442
4543async function run ( ) {
@@ -48,7 +46,7 @@ async function run() {
4846 await Sentry . startSpan ( { op : 'function' , name : 'main' } , async ( ) => {
4947 const client = new GoogleGenAI ( {
5048 apiKey : 'mock-api-key' ,
51- httpOptions : { baseUrl : `http://localhost:${ PORT } ` } ,
49+ httpOptions : { baseUrl : `http://localhost:${ server . address ( ) . port } ` } ,
5250 } ) ;
5351
5452 // Test 1: chats.create and sendMessage flow
Original file line number Diff line number Diff line change 11import express from 'express' ;
22import OpenAI from 'openai' ;
33
4- const PORT = 3333 ;
5-
64function startMockOpenAiServer ( ) {
75 const app = express ( ) ;
86 app . use ( express . json ( ) ) ;
@@ -31,14 +29,14 @@ function startMockOpenAiServer() {
3129 } ,
3230 } ) ;
3331 } ) ;
34- return app . listen ( PORT ) ;
32+ return app . listen ( ) ;
3533}
3634
3735async function run ( ) {
3836 const server = startMockOpenAiServer ( ) ;
3937
4038 const client = new OpenAI ( {
41- baseURL : `http://localhost:${ PORT } /openai` ,
39+ baseURL : `http://localhost:${ server . address ( ) . port } /openai` ,
4240 apiKey : 'mock-api-key' ,
4341 } ) ;
4442
You can’t perform that action at this time.
0 commit comments