Using Mocha in strict mode?

488 views
Skip to first unread message

Claes Gyllensvärd

unread,
Jan 14, 2013, 2:28:33 PM1/14/13
to moc...@googlegroups.com
Since Mocha is a tool for increased code-quality, it seemed to me like a natural thing to accompany my tests with using strict mode.

Most of my code was easy enough to fix for strictness, but it doesn't appear like mocha supports strict mode.

I added --use_strict to the list of supported pass-through node parameters, changed debug's use of 033 to \u0001b, and got stuck on Mocha for some reason failing to load the "dot reporter". This seemingly works well normally, and I'm not aware of anything in strict mode that would make it fail to require the file that is clearly in place, so I got stuck there.

Has anyone made attempts and/or had success running Mocha in strict mode?

Claes Gyllensvärd

unread,
Jan 14, 2013, 2:34:23 PM1/14/13
to moc...@googlegroups.com

To be precise,
Line 186 below succeeds in normal mode, but fails in strict mode.

185 try {
186   Reporter = require('../lib/reporters/' + program.reporter);
187 } catch (err) {
188   try {
189     Reporter = require(program.reporter);
190   } catch (err) {
191     throw new Error('reporter "' + program.reporter + '" does not exist');
192   }
193 }

Claes Gyllensvärd

unread,
Jan 14, 2013, 3:05:14 PM1/14/13
to moc...@googlegroups.com

I've tested this on both 0.8.16 and 0.9.3 with the same results.

Greg Tener

unread,
Jan 9, 2014, 2:37:08 AM1/9/14
to moc...@googlegroups.com, leth...@gmail.com
I'd also like to do this (for harmony support). I sent this pull request:
Hopefully it can be merged in.
Reply all
Reply to author
Forward
0 new messages