New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(node): Correctly handle Windows paths when resolving module name #5476
Conversation
2585eb6
to
082d66f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test for this?
Possibly, let me try. Looks like I'll need to overwrite |
packages/node/test/module.test.ts
Outdated
|
||
describe('getModule', () => { | ||
test('Windows', async () => { | ||
(require.main as any) = { filename: 'C:\\Users\\Tim\\app.js' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we mock this return value with jest, and mockRestore
afterwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jest.spyOn
complains that require
and require.main
are "not declared configurable". I guess this means the properties are marked as configurable: false
and there is no way to modify them other than by overwriting them?
I've had a better go and restore |
This was causing getsentry/sentry-electron#503
It looks like this was never handled correctly and we don't CI test on Windows so this was never noticed!