Skip to content

Commit 890a794

Browse files
committed
lib: emit localstorage-file warning only once
1 parent 4b152b1 commit 890a794

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/internal/webstorage.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ ObjectDefineProperties(module.exports, {
2424
const location = getOptionValue('--localstorage-file');
2525

2626
if (location === '') {
27+
let warningEmitted = false;
2728
const handler = {
2829
__proto__: null,
2930
get(target, prop) {
30-
process.emitWarning('`--localstorage-file` was provided without a valid path');
31+
if (!warningEmitted) {
32+
process.emitWarning('`--localstorage-file` was provided without a valid path');
33+
warningEmitted = true;
34+
}
35+
3136
return undefined;
3237
},
3338
set(target, prop, value) {
34-
process.emitWarning('`--localstorage-file` was provided without a valid path');
39+
if (!warningEmitted) {
40+
process.emitWarning('`--localstorage-file` was provided without a valid path');
41+
warningEmitted = true;
42+
}
43+
3544
return false;
3645
},
3746
};

0 commit comments

Comments
 (0)