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

Update compatibility mode docs #1855

Merged
merged 5 commits into from
Feb 13, 2025
Merged

Update compatibility mode docs #1855

merged 5 commits into from
Feb 13, 2025

Conversation

heitortsergent
Copy link
Collaborator

@heitortsergent heitortsergent commented Feb 7, 2025

What?

Edits to the compatibility mode page for the k6 v0.57 release.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/k6/next folder of the documentation.

Related PR(s)/Issue(s)

Related to #1853.

@heitortsergent heitortsergent marked this pull request as ready for review February 7, 2025 21:31
@heitortsergent heitortsergent requested a review from a team as a code owner February 7, 2025 21:31
@heitortsergent heitortsergent requested review from oleiade and codebien and removed request for a team February 7, 2025 21:31
@@ -40,40 +40,40 @@ $ k6 run script.js

{{< /code >}}

After v0.53.0 the only difference with base is that `global` (node's global variable) is aliased to the value of `globalThis`.
After v0.53.0, the only difference from the base mode is that `global`, the Node.js global variable, is aliased to the value of `globalThis`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge this sentence with the previous k6 offers two JavaScript compatibility modes:. In this way, the reader can join the list of available modes already having the context about the different.

Otherwise, if someone isn't aware of this concept, while it reads the list then they won't get most of it.

Comment on lines +20 to +25
k6 offers two JavaScript compatibility modes:

- [Extended mode](#extended-mode): The default option. That is `base` + aliasing `global` to `globalThis` - a nodejs compatibility.
- [Base mode](#base-mode): Only using native support in k6 and the underlying JS engine. After v0.53.0 it has the same functionality as `extended` apart from the `global` aliasing.
- [Base mode](#base-mode): Only uses native support in k6 and the underlying JavaScript runtime. For k6 v0.53.0 or higher, it has the same functionality as `extended` apart from the `global` aliasing.
- [Extended mode](#extended-mode): Similar to base mode, with an additional alias from `global` to `globalThis` for Node.js compatibility. This is the default mode.

After k6 v0.53.0, the only difference between the base and extended modes is that `global`, the Node.js global variable, is aliased to the value of `globalThis`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codebien do you think this is better? I'm wondering if it's a little repetitive. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion was to have it early but in a single place. I think it is useful to have this additional context already before starting to read the list. Except if we put it directly on the specific item. But still, it should be only once in total.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I think I'm gonna leave it as is then, there is some repetition but I don't think it's necessarily bad. And we should be able to hide/delete this page in the near future.

@heitortsergent heitortsergent merged commit 71078a2 into main Feb 13, 2025
3 checks passed
@heitortsergent heitortsergent deleted the hts/compatibility-mode branch February 13, 2025 18:18
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.

3 participants