Skip to content

test: drop shadowed ignoreAttributes option - #863

Open
rajanpanth wants to merge 1 commit into
NaturalIntelligence:masterfrom
rajanpanth:test/remove-shadowed-ignoreattributes
Open

test: drop shadowed ignoreAttributes option#863
rajanpanth wants to merge 1 commit into
NaturalIntelligence:masterfrom
rajanpanth:test/remove-shadowed-ignoreattributes

Conversation

@rajanpanth

Copy link
Copy Markdown
Contributor

spec/pathExpression_spec.js sets ignoreAttributes twice in the same object literal:

const parser = new XMLParser({
  ignoreAttributes: false,
  jPath: false,
  ignoreAttributes: (attrName, matcher) => { ... }
});

The later function wins, so the boolean never reaches the parser. esbuild flags it as duplicate-object-key, and most lint configs would too.

The test still passes for the right reason today, since the function is what the spec is about. The risk is the reverse reading: the literal looks like it exercises ignoreAttributes: false alongside the function, so anyone later removing the function would assume boolean behaviour was still covered here when it never was.

Removing the dead line only. 21 specs in the file pass, and the esbuild duplicate-key warning is gone.

Modest severity, flagging that honestly — it's dead code in a test rather than a behaviour bug.

The object literal set ignoreAttributes twice; the boolean was
immediately overridden by the function and never took effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant