Skip to content

Commit 98213cb

Browse files
committed
fixup! lib,src,test: fix tests without SQLite
1 parent 490651f commit 98213cb

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

lib/internal/process/pre_execution.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
refreshOptions,
2222
getEmbedderOptions,
2323
} = require('internal/options');
24+
const config = internalBinding('config');
2425
const {
2526
exposeLazyInterfaces,
2627
defineReplaceableLazyAttribute,
@@ -398,7 +399,7 @@ function setupQuic() {
398399

399400
function setupWebStorage() {
400401
if (getEmbedderOptions().noBrowserGlobals ||
401-
!getEmbedderOptions().hasSQLite ||
402+
!config.hasSQLite ||
402403
!getOptionValue('--experimental-webstorage')) {
403404
return;
404405
}

test/module-hooks/test-module-hooks-builtin-require.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ const { registerHooks } = require('module');
1212

1313
const schemelessBlockList = new Set([
1414
'sea',
15-
'sqlite',
1615
'test',
1716
'test/reporters',
1817
]);
1918

19+
if (common.hasSQLite) {
20+
schemelessBlockList.add('sqlite');
21+
}
22+
2023
const testModules = [];
2124
for (const mod of schemelessBlockList) {
2225
testModules.push(`node:${mod}`);

test/module-hooks/test-module-hooks-load-builtin-require.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ hook.deregister();
3636
// stripped for internal lookups should not get passed into the hooks.
3737
const schemelessBlockList = new Set([
3838
'sea',
39-
'sqlite',
4039
'test',
4140
'test/reporters',
4241
]);
4342

43+
if (common.hasSQLite) {
44+
schemelessBlockList.add('sqlite');
45+
}
46+
4447
const testModules = [];
4548
for (const mod of schemelessBlockList) {
4649
testModules.push(`node:${mod}`);

test/parallel/test-global.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ for (const moduleName of builtinModules) {
5959
'fetch',
6060
'crypto',
6161
'navigator',
62-
'localStorage',
63-
'sessionStorage',
6462
];
63+
if (common.hasSQLite) {
64+
expected.push('localStorage', 'sessionStorage');
65+
}
6566
assert.deepStrictEqual(new Set(Object.keys(globalThis)), new Set(expected));
6667
expected.forEach((value) => {
6768
const desc = Object.getOwnPropertyDescriptor(globalThis, value);

test/parallel/test-sqlite-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
const { skipIfSQLiteMissing } = require('../common/index.mjs');
33
const { test } = require('node:test');
44
const assert = require('node:assert');
5-
const { DatabaseSync } = require('node:sqlite');
65
skipIfSQLiteMissing();
6+
const { DatabaseSync } = require('node:sqlite');
77

88
function checkDefensiveMode(db) {
99
function journalMode() {

test/parallel/test-sqlite-template-tag.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
2-
require('../common');
2+
const { skipIfSQLiteMissing } = require('../common');
3+
skipIfSQLiteMissing();
4+
35
const assert = require('assert');
46
const { DatabaseSync } = require('node:sqlite');
57
const { test, beforeEach } = require('node:test');

0 commit comments

Comments
 (0)