[SERVER-74787] Prepare jstest corpus to be run in strict mode without top-level IIFEs Created: 13/Mar/23  Updated: 31/Oct/23  Resolved: 07/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Matt Broadstone Assignee: Matt Broadstone
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-82621 Shadowing declaration of 'version' in... Open
Backwards Compatibility: Fully Compatible
Participants:
Linked BF Score: 166

 Description   

Part of the transition to using es modules for all tests in the jstest corpus includes removing top-level IIFEs and running all tests implicitly in strict mode. This may challenge some assumptions in existing tests, particularly in assuming that:

  • variables can be assigned without first declaring them (no-undef)
  • variables declared with var are permitted to shadow "global" variables (such as rs, or symbols which are "load"ed into the global scope like isMongos)

As part of my local testing when converting all tests to modules, I enabled a few additional eslint rules and put this patch together. In some cases I have also removed duplicate logic (e.g. reusing FixtureHelpers to determine the fixture type)



 Comments   
Comment by Githook User [ 07/May/23 ]

Author:

{'name': 'Matt Broadstone', 'email': 'mbroadst@mongodb.com', 'username': 'mbroadst'}

Message: SERVER-74787 Prepare jstest corpus for implicit strict mode
Branch: master
https://github.com/mongodb/mongo/commit/43b87324302209cbfa240d6c6b520007669e4ea6

Generated at Thu Feb 08 06:28:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.