From f792c720f41ba5f77f290f1694a66d22cab29dc8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 14 Sep 2016 11:16:44 -0700 Subject: [PATCH] Allow spec to be run multiple times in same runner --- spec/api-ipc-spec.js | 2 +- .../function-with-missing-properties.js | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index 1580573beb2b..542c7426def7 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -70,7 +70,7 @@ describe('ipc module', function () { assert.ok(Object.keys(a.foo).includes('nested')) assert.ok(Object.keys(a.foo).includes('method1')) - a = remote.require(path.join(fixtures, 'module', 'function-with-missing-properties.js')) + a = remote.require(path.join(fixtures, 'module', 'function-with-missing-properties.js')).setup() assert.equal(a.bar(), true) assert.equal(typeof a.bar.baz, 'function') }) diff --git a/spec/fixtures/module/function-with-missing-properties.js b/spec/fixtures/module/function-with-missing-properties.js index b88e3397b265..d247485a17b6 100644 --- a/spec/fixtures/module/function-with-missing-properties.js +++ b/spec/fixtures/module/function-with-missing-properties.js @@ -1,11 +1,13 @@ -const foo = {} +exports.setup = function () { + const foo = {} -foo.bar = function () { - return delete foo.bar.baz && delete foo.bar + foo.bar = function () { + return delete foo.bar.baz && delete foo.bar + } + + foo.bar.baz = function () { + return 3 + } + + return foo } - -foo.bar.baz = function () { - return 3 -} - -module.exports = foo