Underscore currently breaks in 'strict' mode while trying to access properties on the global object. The global object is being set using the (function(root) { ... })(this) pattern. However, in this case, root remains undefined and hence the issue.
Using the Function("return this")() pattern instead alleviates the issue, though arguably ugly. Thoughts?
Steps to reproduce: Import underscore in a babel-jest test harness. (uses strict mode)
Underscore currently breaks in
'strict'mode while trying to access properties on the global object. The global object is being set using the(function(root) { ... })(this)pattern. However, in this case,rootremainsundefinedand hence the issue.Using the
Function("return this")()pattern instead alleviates the issue, though arguably ugly. Thoughts?Steps to reproduce: Import underscore in a
babel-jesttest harness. (uses strict mode)