nodejs/test/parallel/test-permission-sqlite-load-extension.js
Michael Dawson 535c2f7562 sqlite: add build option to build without sqlite
Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/58122
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-05-07 17:20:57 -04:00

18 lines
630 B
JavaScript

'use strict';
const common = require('../common');
common.skipIfSQLiteMissing();
const assert = require('node:assert');
const code = `const sqlite = require('node:sqlite');
const db = new sqlite.DatabaseSync(':memory:', { allowExtension: true });
db.loadExtension('nonexistent');`.replace(/\n/g, ' ');
common.spawnPromisified(
process.execPath,
['--permission', '--eval', code],
).then(common.mustCall(({ code, stderr }) => {
assert.match(stderr, /Error: Cannot load SQLite extensions when the permission model is enabled/);
assert.match(stderr, /code: 'ERR_LOAD_SQLITE_EXTENSION'/);
assert.strictEqual(code, 1);
}));