1

I'm building unit tests in jasmine based on examples I've seen with AngularJS. The examples, such as this unit test in the Angular PhoneCat tutorial, use the global form of 'use strict'. However, JSHint complains that I should

Use the function form of "use strict".

I know why 'use strict' is important, and I think I understand why you should use the function form of 'use strict' instead of the global form in your source files. However, in jasmine test files, is it OK to use the global form of 'use strict'?

If so, can I suppress these JSHint warnings for my jasmine test files only?

drs
  • 5,679
  • 4
  • 42
  • 67
  • As far as I know, 'use strict' is simply to encourage better coding practices. For test cases I would just ignore it – Downgoat Mar 26 '15 at 02:52

1 Answers1

0

Of course, you can ignore it, in JSHint, but as vihan1086 said, this will urge you to write better code, by throwing exceptions. See the following post here.

Community
  • 1
  • 1
Lipata
  • 296
  • 1
  • 10
  • Thanks for the answer, but this misses the question a bit. I've updated my post to clarify what I'm asking. – drs Mar 27 '15 at 21:32