diff --git a/test/clientside/run.js b/test/clientside/run.js index 99a117b..bf1a1bf 100644 --- a/test/clientside/run.js +++ b/test/clientside/run.js @@ -50,6 +50,7 @@ var clientTests = [ , 'noCallThru' , 'argument-validation' , 'falsy' + , 'use-strict' ]; compileAll(clientTests, function (err, results) { diff --git a/test/clientside/use-strict.js b/test/clientside/use-strict.js new file mode 100644 index 0000000..b9f2cfe --- /dev/null +++ b/test/clientside/use-strict.js @@ -0,0 +1,18 @@ +// comments are ok before 'use strict' +'use strict' + +var proxyquire = require('proxyquireify')(require) +var barber = { + bar: function () { return 'barber' } +} + +function proxy () { + // missing var declaration throws in strict-mode, otherwise not + foober = proxyquire('../fixtures/foo', { './bar': barber }) + return foober +} + +test('\nstrict mode compliant', function (t) { + t.throws(proxy, new ReferenceError('foober is not defined'), 'strict mode is active') + t.end() +})