mirror of
https://github.com/nodejs/node.git
synced 2025-12-27 23:41:14 +00:00
lib,src,test: fix tests without SQLite
PR-URL: https://github.com/nodejs/node/pull/60906 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
4db307a4b0
commit
14f02fc2f7
2
.github/workflows/test-shared.yml
vendored
2
.github/workflows/test-shared.yml
vendored
@ -192,7 +192,7 @@ jobs:
|
||||
--arg ccache '(import <nixpkgs> {}).sccache' \
|
||||
--arg devTools '[]' \
|
||||
--arg benchmarkTools '[]' \
|
||||
${{ endsWith(matrix.system, '-darwin') && '--arg extraConfigFlags ''["--without-amaro" "--without-inspector" "--without-node-options"]'' \' || '\' }}
|
||||
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
|
||||
--run '
|
||||
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
|
||||
'
|
||||
|
||||
2
node.gyp
2
node.gyp
@ -933,7 +933,6 @@
|
||||
'sources': [
|
||||
'<@(node_sqlite_sources)',
|
||||
],
|
||||
'defines': [ 'HAVE_SQLITE=1' ],
|
||||
}],
|
||||
[ 'node_shared=="true" and node_module_version!="" and OS!="win"', {
|
||||
'product_extension': '<(shlib_suffix)',
|
||||
@ -982,7 +981,6 @@
|
||||
'sources': [
|
||||
'<@(node_sqlite_sources)',
|
||||
],
|
||||
'defines': [ 'HAVE_SQLITE=1' ],
|
||||
}],
|
||||
[ 'OS in "linux freebsd mac solaris openharmony" and '
|
||||
'target_arch=="x64" and '
|
||||
|
||||
@ -436,5 +436,10 @@
|
||||
}, {
|
||||
'defines': [ 'HAVE_AMARO=0' ]
|
||||
}],
|
||||
[ 'node_use_sqlite=="true"', {
|
||||
'defines': [ 'HAVE_SQLITE=1' ],
|
||||
}, {
|
||||
'defines': [ 'HAVE_SQLITE=0' ]
|
||||
}],
|
||||
],
|
||||
}
|
||||
|
||||
@ -577,7 +577,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
||||
"experimental Web Storage API",
|
||||
&EnvironmentOptions::webstorage,
|
||||
kAllowedInEnvvar,
|
||||
true);
|
||||
HAVE_SQLITE);
|
||||
AddAlias("--webstorage", "--experimental-webstorage");
|
||||
AddOption("--localstorage-file",
|
||||
"file used to persist localStorage data",
|
||||
|
||||
@ -127,7 +127,7 @@ class EnvironmentOptions : public Options {
|
||||
bool experimental_fetch = true;
|
||||
bool experimental_websocket = true;
|
||||
bool experimental_sqlite = true;
|
||||
bool webstorage = true;
|
||||
bool webstorage = HAVE_SQLITE;
|
||||
#ifndef OPENSSL_NO_QUIC
|
||||
bool experimental_quic = false;
|
||||
#endif
|
||||
|
||||
@ -370,7 +370,6 @@ const knownGlobals = new Set([
|
||||
'CompressionStream',
|
||||
'DecompressionStream',
|
||||
'Storage',
|
||||
'sessionStorage',
|
||||
].forEach((i) => {
|
||||
if (globalThis[i] !== undefined) {
|
||||
knownGlobals.add(globalThis[i]);
|
||||
@ -387,6 +386,9 @@ if (hasCrypto) {
|
||||
if (hasLocalStorage) {
|
||||
knownGlobals.add(globalThis.localStorage);
|
||||
}
|
||||
if (hasSQLite) {
|
||||
knownGlobals.add(globalThis.sessionStorage);
|
||||
}
|
||||
|
||||
const { Worker } = require('node:worker_threads');
|
||||
knownGlobals.add(Worker);
|
||||
|
||||
@ -12,11 +12,14 @@ const { registerHooks } = require('module');
|
||||
|
||||
const schemelessBlockList = new Set([
|
||||
'sea',
|
||||
'sqlite',
|
||||
'test',
|
||||
'test/reporters',
|
||||
]);
|
||||
|
||||
if (common.hasSQLite) {
|
||||
schemelessBlockList.add('sqlite');
|
||||
}
|
||||
|
||||
const testModules = [];
|
||||
for (const mod of schemelessBlockList) {
|
||||
testModules.push(`node:${mod}`);
|
||||
|
||||
@ -36,11 +36,14 @@ hook.deregister();
|
||||
// stripped for internal lookups should not get passed into the hooks.
|
||||
const schemelessBlockList = new Set([
|
||||
'sea',
|
||||
'sqlite',
|
||||
'test',
|
||||
'test/reporters',
|
||||
]);
|
||||
|
||||
if (common.hasSQLite) {
|
||||
schemelessBlockList.add('sqlite');
|
||||
}
|
||||
|
||||
const testModules = [];
|
||||
for (const mod of schemelessBlockList) {
|
||||
testModules.push(`node:${mod}`);
|
||||
|
||||
@ -59,9 +59,10 @@ for (const moduleName of builtinModules) {
|
||||
'fetch',
|
||||
'crypto',
|
||||
'navigator',
|
||||
'localStorage',
|
||||
'sessionStorage',
|
||||
];
|
||||
if (common.hasSQLite) {
|
||||
expected.push('localStorage', 'sessionStorage');
|
||||
}
|
||||
assert.deepStrictEqual(new Set(Object.keys(globalThis)), new Set(expected));
|
||||
expected.forEach((value) => {
|
||||
const desc = Object.getOwnPropertyDescriptor(globalThis, value);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
const { skipIfSQLiteMissing } = require('../common/index.mjs');
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
skipIfSQLiteMissing();
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
function checkDefensiveMode(db) {
|
||||
function journalMode() {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
const { skipIfSQLiteMissing } = require('../common');
|
||||
skipIfSQLiteMissing();
|
||||
|
||||
const assert = require('assert');
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const { test, beforeEach } = require('node:test');
|
||||
|
||||
8
test/parallel/test-webstorage-without-sqlite.js
Normal file
8
test/parallel/test-webstorage-without-sqlite.js
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const { hasSQLite } = require('../common');
|
||||
const assert = require('node:assert');
|
||||
|
||||
// Ensuring that `sessionStorage` is not a getter that throws when built without SQLite.
|
||||
assert.strictEqual(typeof sessionStorage, hasSQLite ? 'object' : 'undefined');
|
||||
assert.strictEqual(Object.hasOwn(globalThis, 'sessionStorage'), hasSQLite);
|
||||
1
typings/internalBinding/config.d.ts
vendored
1
typings/internalBinding/config.d.ts
vendored
@ -8,6 +8,7 @@ export interface ConfigBinding {
|
||||
hasTracing: boolean;
|
||||
hasNodeOptions: boolean;
|
||||
hasInspector: boolean;
|
||||
hasSQLite: boolean;
|
||||
noBrowserGlobals: boolean;
|
||||
bits: number;
|
||||
getDefaultLocale(): string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user