Add test for require
to search under app dir
This commit is contained in:
parent
a686237d9b
commit
673f4f4d0c
1 changed files with 16 additions and 0 deletions
|
@ -2,6 +2,8 @@ const assert = require('assert')
|
||||||
const Module = require('module')
|
const Module = require('module')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const temp = require('temp')
|
const temp = require('temp')
|
||||||
|
const {remote} = require('electron')
|
||||||
|
const {BrowserWindow} = remote
|
||||||
|
|
||||||
describe('third-party module', function () {
|
describe('third-party module', function () {
|
||||||
var fixtures = path.join(__dirname, 'fixtures')
|
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()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue