Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: skip test-sqlite-extensions when it is missing #56455

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions test/sqlite/test-sqlite-extensions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ if (process.config.variables.node_shared_sqlite) {
common.skip('Missing libsqlite_extension binary');
}

// Lib extension binary is named differently on different platforms
function resolveBuiltBinary(binary) {
const targetFile = fs.readdirSync(path.dirname(process.execPath)).find((file) => file.startsWith(binary));
return path.join(path.dirname(process.execPath), targetFile);
const binDir = path.dirname(process.execPath);
let binary;
for await (const { name } of await fs.promises.opendir(binDir)) {
// Lib extension binary is named differently on different platforms
if (name.startsWith('libsqlite_extension')) {
binary = path.join(binDir, name);
break;
}
}

const binary = resolveBuiltBinary('libsqlite_extension');
if (binary == null) {
common.skip('Missing libsqlite_extension binary');
}

test('should load extension successfully', () => {
const db = new sqlite.DatabaseSync(':memory:', {
Expand Down
Loading