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

Allow monaco-editor to work propertly with Jest #109833

Merged
merged 2 commits into from Nov 3, 2020

Conversation

fleon
Copy link
Contributor

@fleon fleon commented Nov 2, 2020

In Node.js environments where Jest is run, global is already an existing variable. Using const to redeclare it causes an error and therefore makes it impossible to run any monaco-editor related tests with Jest. Changing this line from const to var doesn't cause this issue.

We use monaco-editor in GitLab, and in order to upgrade it to the latest version and make it work with Jest, the only solution was to patch it using patch-package. The patch solution doesn't scale so well.

Here's a bit more info: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46436#note_438312326

In Node.js environments where Jest is run, `global` is already an existing
variable. Using `const` to redeclare it causes an error and therefore makes it
impossible to run any `monaco-editor` related tests to run with Jest. Changing
this line from `const` to `var` doesn't cause this issue.
@fleon
Copy link
Contributor Author

fleon commented Nov 2, 2020

Alternatively, it would also be worthwhile calling this variable something other than global, if using var isn't recommended by linters. There are only 5 occurences in this file, and nowhere else in this repository, so that should be also a good alternative.

@fleon fleon changed the title Use var instead of const for the global variable Allow monaco-editor to work propertly with Jest Nov 2, 2020
@mjbvz mjbvz assigned alexdima and unassigned mjbvz Nov 2, 2020
@alexdima alexdima added this to the November 2020 milestone Nov 3, 2020
@alexdima alexdima merged commit e934668 into microsoft:master Nov 3, 2020
@fleon
Copy link
Contributor Author

fleon commented Nov 4, 2020

@alexdima Thanks for merging this. Any potential timelines for the release of this fix?

@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants