Skip to content

Commit

Permalink
[Tests] check side-effects of pollution protection
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn authored and ljharb committed Feb 18, 2023
1 parent 34e20b8 commit 3dbebff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/proto.js
Expand Up @@ -5,6 +5,20 @@ var test = require('tape');

/* eslint no-proto: 0 */

// Not pollution as such, but verify protections working as intended.
test('trailing __proto__ key in dotted option ignored', function (t) {
var argv = parse(['--a.__proto__', 'IGNORED']);
t.deepEqual(argv.a, {});
t.end();
});

// Not pollution as such, but verify protections working as intended.
test('trailing constructor key in dotted option ignored', function (t) {
var argv = parse(['--a.constructor', 'IGNORED']);
t.deepEqual(argv.a, {});
t.end();
});

test('proto pollution', function (t) {
var argv = parse(['--__proto__.x', '123']);
t.equal({}.x, undefined);
Expand Down

0 comments on commit 3dbebff

Please sign in to comment.