Skip to content
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

benchmark: use options.filename when, for esm, require.main.filename is undefined #55027

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iambumblehead
Copy link

These changes allow benchmark/common.js to be imported and used by esm scripts.

Advice, suggestions and any input at all are welcome. Thank you for reading me :)

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. performance Issues and PRs related to the performance of Node.js. labels Sep 20, 2024
@RedYetiDev RedYetiDev added esm Issues and PRs related to the ECMAScript Modules implementation. and removed performance Issues and PRs related to the performance of Node.js. labels Sep 20, 2024
@joyeecheung
Copy link
Member

This feels quite hacky - can't we just take an explicit filename in the createBenchmark() options?

@iambumblehead iambumblehead force-pushed the benchmark-detect-filename-esm-runtime branch from 99999cc to 1e2fab5 Compare September 21, 2024 02:50
@iambumblehead iambumblehead changed the title benchmark: for esm when require.main is undefined, probe filename from error stack benchmark: use options.filename when, for esm, require.main.filename is undefined Sep 21, 2024
@iambumblehead iambumblehead force-pushed the benchmark-detect-filename-esm-runtime branch from 1e2fab5 to 06e95fb Compare September 21, 2024 02:54
@iambumblehead
Copy link
Author

@joyeecheung thank you for the comment. The commit is amended to use explicit options.filename from createBenchmark() options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants