2024-12-03 15:15:46 -08:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
2025-04-29 22:38:51 +00:00
|
|
|
common.skipIfSQLiteMissing();
|
2024-12-03 15:15:46 -08:00
|
|
|
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, ' ');
|
|
|
|
|
2024-12-19 18:11:19 +01:00
|
|
|
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);
|
|
|
|
}));
|