From 9b47da38dc3f2ce55f26a729c3a3696676f6d2d3 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 14 Apr 2024 03:06:03 -0700 Subject: [PATCH] docs+flaky test --- docs/api/sqlite.md | 4 ++-- test/js/bun/sqlite/sqlite.test.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/api/sqlite.md b/docs/api/sqlite.md index 1ef3e1a914138..04ab1bbf4d63d 100644 --- a/docs/api/sqlite.md +++ b/docs/api/sqlite.md @@ -417,12 +417,12 @@ db.loadExtension("myext"); To use the advanced `sqlite3_file_control` API, call `.fileControl(cmd, value)` on your `Database` instance. ```ts -import { Database } from "bun:sqlite"; +import { Database, constants } from "bun:sqlite"; const db = new Database(); // Ensure WAL mode is NOT persistent // this prevents wal files from lingering after the database is closed -db.fileControl(SQL.constants.SQLITE_FCNTL_PERSIST_WAL, 0); +db.fileControl(constants.SQLITE_FCNTL_PERSIST_WAL, 0); ``` `value` can be: diff --git a/test/js/bun/sqlite/sqlite.test.js b/test/js/bun/sqlite/sqlite.test.js index a20fa96502242..f75c2f03153c6 100644 --- a/test/js/bun/sqlite/sqlite.test.js +++ b/test/js/bun/sqlite/sqlite.test.js @@ -2,7 +2,7 @@ import { expect, it, describe } from "bun:test"; import { Database, constants, SQLiteError } from "bun:sqlite"; import { existsSync, fstat, readdirSync, realpathSync, rmSync, writeFileSync } from "fs"; import { spawnSync } from "bun"; -import { bunExe, tempDirWithFiles } from "harness"; +import { bunExe, isWindows, tempDirWithFiles } from "harness"; import { tmpdir } from "os"; import path from "path"; @@ -852,7 +852,10 @@ it("can continue to use existing statements after database has been GC'd", async expect(stmt.all()).toEqual([{ id: 1, name: "foo" }]); stmt.finalize(); expect(() => stmt.all()).toThrow(); - expect(called).toBe(true); + if (!isWindows) { + // on Windows, FinalizationRegistry is more flaky than on POSIX. + expect(called).toBe(true); + } }); it("statements should be disposable", () => {