diff --git a/packages/store-postgres/src/store.test.ts b/packages/store-postgres/src/store.test.ts index e048715..7c2425b 100644 --- a/packages/store-postgres/src/store.test.ts +++ b/packages/store-postgres/src/store.test.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; import { PGlite } from '@electric-sql/pglite'; -import { describe, expect, test } from 'vitest'; +import { beforeAll, describe, expect, test } from 'vitest'; import { describeStore } from '../../core/test/store-contract.ts'; import { migrate } from './migrate.ts'; import type { Sql } from './sql.ts'; @@ -27,6 +27,12 @@ async function freshDatabase(): Promise { return sql; } +// The first PGlite in a process compiles its WebAssembly, which can take seconds on a busy +// machine. Do it here, with its own time limit, so no test pays for it. +beforeAll(async () => { + await (await PGlite.create()).close(); +}, 60_000); + describeStore('PostgresStore', async () => new PostgresStore(await freshDatabase())); describe('migrate', () => {