Last active
February 24, 2023 16:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
class Test { | |
getExtension() { | |
return path.extname(__filename); | |
} | |
} | |
module.exports = Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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