Skip to content

Instantly share code, notes, and snippets.

@kyrylo-hrechykhin
Last active February 24, 2023 16:50
Show Gist options
  • Save kyrylo-hrechykhin/f0afe7c469145c51d4df39fbea97ec95 to your computer and use it in GitHub Desktop.
Save kyrylo-hrechykhin/f0afe7c469145c51d4df39fbea97ec95 to your computer and use it in GitHub Desktop.
Demo app to reproduce the issue where proxyquire can't load module after window.open method is called
{
"name": "proxyquire-test",
"dependencies": {
"electron": "23.0.0",
"electron-mocha": "^11.0.2",
"proxyquire": "^2.1.3"
},
"scripts": {
"start": "electron-mocha --renderer *.spec.js"
},
"license": "MIT"
}
const path = require('path')
class Test {
getExtension() {
return path.extname(__filename);
}
}
module.exports = Test;
const proxyquire = require('proxyquire')
window.open('');
describe('test', () => {
it(`should log 'Test pass' in the console`, () => {
proxyquire('./test', {
'path': {}
});
console.log('Test pass.');
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment