testing/javascript: Add libsql to compatibility test suite

This commit is contained in:
Pekka Enberg
2025-07-29 16:07:35 +03:00
parent b4dc9bebe0
commit c39f0e7557
4 changed files with 181 additions and 4 deletions

View File

@@ -410,6 +410,11 @@ const connect = async (path, options = {}) => {
const db = new x.default(path, options);
return [db, x.SqliteError];
}
if (provider === "libsql") {
const x = await import("libsql/promise");
const db = new x.default(path, options);
return [db, x.SqliteError, path];
}
if (provider === "serverless") {
const x = await import("@tursodatabase/serverless");
const url = process.env.TURSO_DATABASE_URL;

View File

@@ -453,6 +453,11 @@ const connect = async (path, options = {}) => {
const db = new x.default(path, options);
return [db, x.SqliteError, provider];
}
if (provider === "libsql") {
const x = await import("libsql");
const db = new x.default(path, options);
return [db, x.SqliteError, provider, path];
}
if (provider == "better-sqlite3") {
const x = await import("better-sqlite3");
const db = x.default(path, options);

View File

@@ -8,7 +8,8 @@
"dependencies": {
"@tursodatabase/serverless": "../../packages/turso-serverless",
"@tursodatabase/turso": "../../bindings/javascript",
"better-sqlite3": "^11.9.1"
"better-sqlite3": "^11.9.1",
"libsql": "^0.5.17"
},
"devDependencies": {
"ava": "^5.3.0"
@@ -21,7 +22,7 @@
"devDependencies": {
"@napi-rs/cli": "^3.0.4",
"@napi-rs/wasm-runtime": "^1.0.1",
"ava": "^5.3.0",
"ava": "^6.0.1",
"better-sqlite3": "^11.9.1"
},
"engines": {
@@ -38,6 +39,129 @@
"typescript": "^5.8.3"
}
},
"node_modules/@libsql/darwin-arm64": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/darwin-arm64/-/darwin-arm64-0.5.17.tgz",
"integrity": "sha512-WTYG2skZsUnZmfZ2v7WFj7s3/5s2PfrYBZOWBKOnxHA8g4XCDc/4bFDaqob9Q2e88+GC7cWeJ8VNkVBFpD2Xxg==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@libsql/darwin-x64": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/darwin-x64/-/darwin-x64-0.5.17.tgz",
"integrity": "sha512-ab0RlTR4KYrxgjNrZhAhY/10GibKoq6G0W4oi0kdm+eYiAv/Ip8GDMpSaZdAcoKA4T+iKR/ehczKHnMEB8MFxA==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@libsql/linux-arm-gnueabihf": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-arm-gnueabihf/-/linux-arm-gnueabihf-0.5.17.tgz",
"integrity": "sha512-PcASh4k47RqC+kMWAbLUKf1y6Do0q8vnUGi0yhKY4ghJcimMExViBimjbjYRSa+WIb/zh3QxNoXOhQAXx3tiuw==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/linux-arm-musleabihf": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-arm-musleabihf/-/linux-arm-musleabihf-0.5.17.tgz",
"integrity": "sha512-vxOkSLG9Wspit+SNle84nuIzMtr2G2qaxFzW7BhsZBjlZ8+kErf9RXcT2YJQdJYxmBYRbsOrc91gg0jLEQVCqg==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/linux-arm64-gnu": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-arm64-gnu/-/linux-arm64-gnu-0.5.17.tgz",
"integrity": "sha512-L8jnaN01TxjBJlDuDTX2W2BKzBkAOhcnKfCOf3xzvvygblxnDOK0whkYwIXeTfwtd/rr4jN/d6dZD/bcHiDxEQ==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/linux-arm64-musl": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-arm64-musl/-/linux-arm64-musl-0.5.17.tgz",
"integrity": "sha512-HfFD7TzQtmmTwyQsuiHhWZdMRtdNpKJ1p4tbMMTMRECk+971NFHrj69D64cc2ClVTAmn7fA9XibKPil7WN/Q7w==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/linux-x64-gnu": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-x64-gnu/-/linux-x64-gnu-0.5.17.tgz",
"integrity": "sha512-5l3XxWqUPVFrtX0xnZaXwqsXs0BFbP4w6ahRFTPSdXU50YBfUOajFznJRB6bJTMsCvraDSD0IkHhjSNfrE1CuQ==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/linux-x64-musl": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/linux-x64-musl/-/linux-x64-musl-0.5.17.tgz",
"integrity": "sha512-FvSpWlwc+dIeYIFYlsSv+UdQ/NiZWr+SstwVji+QZ//8NnvzwWQU9cgP+Vpps6Qiq4jyYQm9chJhTYOVT9Y3BA==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@libsql/win32-x64-msvc": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@libsql/win32-x64-msvc/-/win32-x64-msvc-0.5.17.tgz",
"integrity": "sha512-f5bGH8+3A5sn6Lrqg8FsQ09a1pYXPnKGXGTFiAYlfQXVst1tUTxDTugnuWcJYKXyzDe/T7ccxyIZXeSmPOhq8A==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@neon-rs/load": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@neon-rs/load/-/load-0.0.4.tgz",
"integrity": "sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==",
"license": "MIT"
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -1211,6 +1335,47 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/libsql": {
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/libsql/-/libsql-0.5.17.tgz",
"integrity": "sha512-RRlj5XQI9+Wq+/5UY8EnugSWfRmHEw4hn3DKlPrkUgZONsge1PwTtHcpStP6MSNi8ohcbsRgEHJaymA33a8cBw==",
"cpu": [
"x64",
"arm64",
"wasm32",
"arm"
],
"license": "MIT",
"os": [
"darwin",
"linux",
"win32"
],
"dependencies": {
"@neon-rs/load": "^0.0.4",
"detect-libc": "2.0.2"
},
"optionalDependencies": {
"@libsql/darwin-arm64": "0.5.17",
"@libsql/darwin-x64": "0.5.17",
"@libsql/linux-arm-gnueabihf": "0.5.17",
"@libsql/linux-arm-musleabihf": "0.5.17",
"@libsql/linux-arm64-gnu": "0.5.17",
"@libsql/linux-arm64-musl": "0.5.17",
"@libsql/linux-x64-gnu": "0.5.17",
"@libsql/linux-x64-musl": "0.5.17",
"@libsql/win32-x64-msvc": "0.5.17"
}
},
"node_modules/libsql/node_modules/detect-libc": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
"integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/load-json-file": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-7.0.1.tgz",

View File

@@ -6,14 +6,16 @@
"test": "npm run test:turso && npm run test:serverless && npm run test:better-sqlite3",
"test:turso": "PROVIDER=turso ava __test__/*.test.js",
"test:serverless": "PROVIDER=serverless ava __test__/async.test.js",
"test:libsql": "PROVIDER=libsql ava __test__/*.test.js",
"test:better-sqlite3": "PROVIDER=better-sqlite3 ava __test__/sync.test.js"
},
"devDependencies": {
"ava": "^5.3.0"
},
"dependencies": {
"@tursodatabase/turso": "../../bindings/javascript",
"@tursodatabase/serverless": "../../packages/turso-serverless",
"better-sqlite3": "^11.9.1"
"@tursodatabase/turso": "../../bindings/javascript",
"better-sqlite3": "^11.9.1",
"libsql": "^0.5.17"
}
}