Skip to content

fix(node): Module name resolution #10144

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

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jan 10, 2024

The default basePath for createGetModuleFromFilename is dirname(process.argv[1]):

/** Creates a function that gets the module name from a filename */
export function createGetModuleFromFilename(
  basePath: string = dirname(process.argv[1]),

But the tests used a trailing slash for the base path:

const getModuleFromFilenameWindows = createGetModuleFromFilename('C:\\Users\\Tim\\', true);
const getModuleFromFilenamePosix = createGetModuleFromFilename('/Users/Tim/');

Which means in some situations the module name can include a leading ..

The tests need to pass without a trailing slash on the basePath!

@timfish timfish requested a review from lforst January 10, 2024 19:16
@timfish timfish marked this pull request as draft January 10, 2024 23:47
@timfish timfish marked this pull request as ready for review January 11, 2024 00:31
@lforst lforst merged commit 840a307 into getsentry:develop Jan 11, 2024
@timfish timfish deleted the fix/module-name branch January 11, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants