diff --git a/spec/modules-spec.js b/spec/modules-spec.js index 5f8271752711..26cafc7ccb25 100644 --- a/spec/modules-spec.js +++ b/spec/modules-spec.js @@ -2,6 +2,8 @@ const assert = require('assert') const Module = require('module') const path = require('path') const temp = require('temp') +const {remote} = require('electron') +const {BrowserWindow} = remote describe('third-party module', function () { var fixtures = path.join(__dirname, 'fixtures') @@ -129,3 +131,17 @@ describe('Module._nodeModulePaths', function () { }) }) }) + +describe('require', () => { + describe('when loaded URL is not file: protocol', () => { + it('searches for module under app directory', async () => { + const w = new BrowserWindow({ + show: false, + }) + w.loadURL('about:blank') + const result = await w.webContents.executeJavaScript('typeof require("q").when') + assert.equal(result, 'function') + w.destroy() + }) + }) +})