Mac and Windows version show different warnings for node.js mocha

I have a test using mocha in a project.  I frequently edit this project on both Mac and Windows.  The windows version shows "require() call is missing" on the describe and beforeEach methods in the test file, the mac version shows nothing.  Why are these 2 behaving different, I would assume they would behave the same.  Is there a difference in these 2 versions?

Comment actions Permalink

Indeed, there should be no difference:)
"require() call is missing" is a new inspection introduced in v. 11  - it checks if the module used in code is referenced through require()  statement. This inspection, indeed, is redundant for mocha tests, as  "describe" symbol is added to the global context by mocha (like "it", "beforeEach", etc.) and doesn't need to be imported explicitly.
You can either disable this inspection or suppress it for mocha tests. Alt+Enter on 'describe', hit Right, choose 'Suppress for statement'.  Unfortunately you would have to repeat these steps for each 'describe'  call:(
Another option: create a custom scope with your spec files excluded  (Settings/Appearance & Behavior/Scopes), then choose this scope for  'Missing require() statement' inspection  (Settings/Editor/Inspections/Javascript/Node.js)


Please sign in to leave a comment.