diff --git a/lib/injectr.js b/lib/injectr.js index 8256d29..f32c6e7 100644 --- a/lib/injectr.js +++ b/lib/injectr.js @@ -29,6 +29,7 @@ module.exports = function (file, mocks, context) { }; context.module = context.module || {}; context.module.exports = {}; + context.exports = context.module.exports; script.runInNewContext(context); return context.module.exports; diff --git a/test/spec.js b/test/spec.js index 03a86a4..5e68371 100644 --- a/test/spec.js +++ b/test/spec.js @@ -91,6 +91,14 @@ describe("injectr", function () { expect(context.module).to.have.property('exports'); expect(context.module.exports).to.be.an('object'); }); + it("should have an exports property equal to module.exports", function () { + var context, + mockScript; + this.injectr('filename'); + mockScript = this.mockVm.createScript.calls[0].pretendr; + context = mockScript.runInNewContext.calls[0].args[0]; + expect(context).to.have.property('exports', context.module.exports); + }); it("should return module.exports", function () { var context, mockScript,