Skip to content

Commit b562044

Browse files
committed
test: remove --experimental-webstorage flag from tests
1 parent 14b0234 commit b562044

3 files changed

Lines changed: 12 additions & 41 deletions

File tree

test/common/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,12 @@ const knownGlobals = new Set([
315315
'localStorage',
316316
'sessionStorage',
317317
].forEach((i) => {
318-
if (globalThis[i] !== undefined) {
318+
if (i === 'localStorage') {
319+
if (Object.hasOwn(globalThis, i)) {
320+
globalThis[i] = {};
321+
knownGlobals.add(globalThis[i]);
322+
}
323+
} else if (globalThis[i] !== undefined) {
319324
knownGlobals.add(globalThis[i]);
320325
}
321326
});

test/parallel/test-webstorage.js

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,9 @@ function nextLocalStorage() {
1414
return join(tmpdir.path, `${++cnt}.localstorage`);
1515
}
1616

17-
test('disabled without --experimental-webstorage', async () => {
18-
for (const api of ['Storage', 'localStorage', 'sessionStorage']) {
19-
const cp = await spawnPromisified(process.execPath, ['-e', api]);
20-
21-
assert.strictEqual(cp.code, 1);
22-
assert.strictEqual(cp.signal, null);
23-
assert.strictEqual(cp.stdout, '');
24-
assert(cp.stderr.includes(`ReferenceError: ${api} is not defined`));
25-
}
26-
});
27-
28-
test('emits a warning when used', async () => {
29-
for (const api of ['Storage', 'localStorage', 'sessionStorage']) {
30-
const cp = await spawnPromisified(process.execPath, [
31-
'--experimental-webstorage',
32-
'--localstorage-file', nextLocalStorage(),
33-
'-e', api,
34-
]);
35-
36-
assert.strictEqual(cp.code, 0);
37-
assert.strictEqual(cp.signal, null);
38-
assert.strictEqual(cp.stdout, '');
39-
assert.match(cp.stderr, /ExperimentalWarning: Web Storage/);
40-
}
41-
});
42-
4317
test('Storage instances cannot be created in userland', async () => {
4418
const cp = await spawnPromisified(process.execPath, [
45-
'--experimental-webstorage', '-e', 'new globalThis.Storage()',
19+
'-e', 'new globalThis.Storage()',
4620
]);
4721

4822
assert.strictEqual(cp.code, 1);
@@ -53,33 +27,30 @@ test('Storage instances cannot be created in userland', async () => {
5327

5428
test('sessionStorage is not persisted', async () => {
5529
let cp = await spawnPromisified(process.execPath, [
56-
'--experimental-webstorage', '-pe', 'sessionStorage.foo = "barbaz"',
30+
'-pe', 'sessionStorage.foo = "barbaz"',
5731
]);
5832
assert.strictEqual(cp.code, 0);
5933
assert.match(cp.stdout, /barbaz/);
6034

6135
cp = await spawnPromisified(process.execPath, [
62-
'--experimental-webstorage', '-pe', 'sessionStorage.foo',
36+
'-pe', 'sessionStorage.foo',
6337
]);
6438
assert.strictEqual(cp.code, 0);
6539
assert.match(cp.stdout, /undefined/);
6640
assert.strictEqual((await readdir(tmpdir.path)).length, 0);
6741
});
6842

69-
test('localStorage throws without --localstorage-file ', async () => {
43+
test('localStorage emits a warning without --localstorage-file ', async () => {
7044
const cp = await spawnPromisified(process.execPath, [
71-
'--experimental-webstorage',
7245
'-pe', 'localStorage === globalThis.localStorage',
7346
]);
74-
assert.strictEqual(cp.code, 1);
47+
assert.strictEqual(cp.code, 0);
7548
assert.strictEqual(cp.signal, null);
76-
assert.strictEqual(cp.stdout, '');
77-
assert.match(cp.stderr, /The argument '--localstorage-file' is an invalid localStorage location/);
49+
assert.match(cp.stderr, /Warning: is an invalid localStorage location/);
7850
});
7951

8052
test('localStorage is not persisted if it is unused', async () => {
8153
const cp = await spawnPromisified(process.execPath, [
82-
'--experimental-webstorage',
8354
'--localstorage-file', nextLocalStorage(),
8455
'-pe', 'localStorage === globalThis.localStorage',
8556
]);
@@ -91,7 +62,6 @@ test('localStorage is not persisted if it is unused', async () => {
9162
test('localStorage is persisted if it is used', async () => {
9263
const localStorageFile = nextLocalStorage();
9364
let cp = await spawnPromisified(process.execPath, [
94-
'--experimental-webstorage',
9565
'--localstorage-file', localStorageFile,
9666
'-pe', 'localStorage.foo = "barbaz"',
9767
]);
@@ -102,7 +72,6 @@ test('localStorage is persisted if it is used', async () => {
10272
assert.match(entries[0], /\d+\.localstorage/);
10373

10474
cp = await spawnPromisified(process.execPath, [
105-
'--experimental-webstorage',
10675
'--localstorage-file', localStorageFile,
10776
'-pe', 'localStorage.foo',
10877
]);
@@ -117,7 +86,6 @@ describe('webstorage quota for localStorage and sessionStorage', () => {
11786
test('localStorage can store and retrieve a max of 10 MB quota', async () => {
11887
const localStorageFile = nextLocalStorage();
11988
const cp = await spawnPromisified(process.execPath, [
120-
'--experimental-webstorage',
12189
'--localstorage-file', localStorageFile,
12290
// Each character is 2 bytes
12391
'-pe', `
@@ -133,7 +101,6 @@ describe('webstorage quota for localStorage and sessionStorage', () => {
133101

134102
test('sessionStorage can store a max of 10 MB quota', async () => {
135103
const cp = await spawnPromisified(process.execPath, [
136-
'--experimental-webstorage',
137104
// Each character is 2 bytes
138105
'-pe', `sessionStorage['a'.repeat(${MAX_STORAGE_SIZE} / 2)] = '';
139106
console.error('filled');

test/wpt/test-webstorage.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const runner = new WPTRunner('webstorage', { concurrency: 1 });
77
tmpdir.refresh();
88

99
runner.setFlags([
10-
'--experimental-webstorage',
1110
'--localstorage-file', join(tmpdir.path, 'wpt-tests.localstorage'),
1211
]);
1312
runner.setInitScript(`

0 commit comments

Comments
 (0)