common: export hideInternalModules

This commit is contained in:
Robo 2016-01-27 14:14:10 +05:30
parent 2c7717d98e
commit a6bcc5d110
3 changed files with 20 additions and 4 deletions

View file

@ -10,6 +10,21 @@ remote = require('electron').remote;
ref = remote.require('electron'), app = ref.app, BrowserWindow = ref.BrowserWindow;
describe('electron module', function() {
it ('can prevent exposing internal modules to require', function(done) {
const electron = require('electron');
const clipboard = require('clipboard');
assert.equal(typeof clipboard, 'object');
electron.hideInternalModules();
try {
require('clipboard');
} catch(err) {
assert.equal(err.message, 'Cannot find module \'clipboard\'');
done();
}
});
});
describe('app module', function() {
describe('app.getVersion()', function() {
return it('returns the version field of package.json', function() {