feat: use deno port generator

This commit is contained in:
2024-07-19 19:26:57 +02:00
parent 4ffcb4a2fa
commit 94b93a3a23
4 changed files with 13 additions and 31 deletions

View File

@@ -1,10 +1,3 @@
import delay from "delay";
import getPort from "port";
import psql, { type Sql } from "postgres";
import type { Container } from "../docker/libraries/container.ts";
import { docker } from "../mod.ts";
/**
* @module
*
@@ -24,6 +17,14 @@ import { docker } from "../mod.ts";
* await container.stop();
* ```
*/
import delay from "delay";
import getPort from "port";
import psql, { type Sql } from "postgres";
import type { Container } from "../docker/libraries/container.ts";
import { docker } from "../mod.ts";
export class PostgresTestContainer {
private constructor(
readonly container: Container,
@@ -68,7 +69,7 @@ export class PostgresTestContainer {
* @param config - Options for the Postgres container.
*/
static async start(image: string, config: Partial<Config> = {}): Promise<PostgresTestContainer> {
const port = await getPort();
const port = getPort();
if (port === undefined) {
throw new Error("Unable to assign to a random port");
}