Skip to content

Commit

Permalink
Added WebSocket shim for http tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jawj committed Dec 18, 2024
1 parent afbca19 commit bcf0060
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/http.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test, vi } from 'vitest';
import { expect, test, vi, beforeAll } from 'vitest';
import { neon, neonConfig, Pool } from '../dist/npm';
import { sampleQueries } from './sampleQueries';

Expand All @@ -7,6 +7,13 @@ const sql = neon(DB_URL);
const sqlFull = neon(DB_URL, { fullResults: true });
const pool = new Pool({ connectionString: DB_URL });

beforeAll(async () => {
if (typeof WebSocket !== 'function') {
const { WebSocket } = await import('ws');
neonConfig.webSocketConstructor = WebSocket;
}
});

test(
'http query results match WebSocket query results',
{ timeout: 30000 },
Expand Down

0 comments on commit bcf0060

Please sign in to comment.