From 5cc61089d92787302e9c04616fff5a2c89499e16 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Aug 2016 09:24:38 -0700 Subject: [PATCH] Add failing spec for remote function with properties --- spec/api-ipc-spec.js | 11 +++++++++++ .../module/export-function-with-properties.js | 4 ++++ spec/fixtures/module/function-with-properties.js | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 spec/fixtures/module/export-function-with-properties.js create mode 100644 spec/fixtures/module/function-with-properties.js diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index 8d08baf0bc..ecd79d2353 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -52,6 +52,17 @@ describe('ipc module', function () { comparePaths(path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules')) }) + it('should work with function properties', function () { + var a = remote.require(path.join(fixtures, 'module', 'export-function-with-properties.js')) + assert.equal(typeof a, 'function') + assert.equal(a.bar, 'baz') + + a = remote.require(path.join(fixtures, 'module', 'function-with-properties.js')) + assert.equal(typeof a, 'object') + assert.equal(typeof a.foo, 'function') + assert.equal(a.foo.bar, 'baz') + }) + it('handles circular references in arrays and objects', function () { var a = remote.require(path.join(fixtures, 'module', 'circular.js')) diff --git a/spec/fixtures/module/export-function-with-properties.js b/spec/fixtures/module/export-function-with-properties.js new file mode 100644 index 0000000000..9c304f6bac --- /dev/null +++ b/spec/fixtures/module/export-function-with-properties.js @@ -0,0 +1,4 @@ +function foo() {} +foo.bar = 'baz' + +module.exports = foo diff --git a/spec/fixtures/module/function-with-properties.js b/spec/fixtures/module/function-with-properties.js new file mode 100644 index 0000000000..7623738f5b --- /dev/null +++ b/spec/fixtures/module/function-with-properties.js @@ -0,0 +1,6 @@ +function foo() {} +foo.bar = 'baz' + +module.exports = { + foo: foo +}