You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@FelixHenninger on Gitter reported that Mocha 3.5.1 gets a "Mismatched anonymous define" error from RequireJS. The following is my investigation of the issue.
Would it be possible to replace the dedefine script with a proper codemod using an AST parser and get something more like "if typeof define and define.amd are both checked in any way"?
Otherwise, I guess we could update the regex to something like /typeof\s+define\s*===?\s*['"]function['"]\s*&&\s*(?:define\.amd|typeof\s+define\.amd\s*===?\s*['"]object['"])/g And then update it again if we ever run into Yoda-style "function" === typeof define. Or if we ever run into typeof define.amd !== 'undefined'. Etc.
Alternatively, we could look for a bundler, bundler flag/option or bundler plugin that handles this stuff for us. Or request that he use the standard typeof define === 'function' && define.amd check.
The text was updated successfully, but these errors were encountered:
@FelixHenninger on Gitter reported that Mocha 3.5.1 gets a "Mismatched anonymous define" error from RequireJS. The following is my investigation of the issue.
Our
define
-removing script uses the regex/typeof define === ['"]function['"] && define\.amd/g
but the new dependencyhe
uses a different, multi-line check.Would it be possible to replace the dedefine script with a proper codemod using an AST parser and get something more like "if typeof define and define.amd are both checked in any way"?
Otherwise, I guess we could update the regex to something like
/typeof\s+define\s*===?\s*['"]function['"]\s*&&\s*(?:define\.amd|typeof\s+define\.amd\s*===?\s*['"]object['"])/g
And then update it again if we ever run into Yoda-style"function" === typeof define
. Or if we ever run intotypeof define.amd !== 'undefined'
. Etc.Alternatively, we could look for a bundler, bundler flag/option or bundler plugin that handles this stuff for us. Or request that
he
use the standardtypeof define === 'function' && define.amd
check.The text was updated successfully, but these errors were encountered: