Skip to content

Commit 849d363

Browse files
committed
test: generate localstorage-file in a temp dir
1 parent 41afe9b commit 849d363

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test/parallel/test-inspector-dom-storage.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
'use strict';
33

44
const common = require('../common');
5-
const assert = require('assert');
65
common.skipIfSQLiteMissing();
76
common.skipIfInspectorDisabled();
7+
const tmpdir = require('../common/tmpdir');
8+
tmpdir.refresh();
9+
// Change cwd to tmpdir so that --localstorage-file=./localstorage.db resolves there.
10+
process.chdir(tmpdir.path);
11+
12+
const assert = require('assert');
813
const { DOMStorage, Session } = require('node:inspector/promises');
914
const { pathToFileURL } = require('node:url');
1015
const path = require('node:path');
@@ -16,7 +21,7 @@ async function testRegisterStorage() {
1621
await session.post('DOMStorage.enable');
1722

1823
const localStorageFileUrl =
19-
pathToFileURL(path.join(process.cwd(), 'localstorage.db')).href;
24+
pathToFileURL(path.join(tmpdir.path, 'localstorage.db')).href;
2025

2126
const { storageKey } = await session.post('Storage.getStorageKey');
2227
assert.strictEqual(

0 commit comments

Comments
 (0)