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

Generated output is incompatible with Jest (again) #149

Open
nex3 opened this issue Nov 2, 2022 · 3 comments
Open

Generated output is incompatible with Jest (again) #149

nex3 opened this issue Nov 2, 2022 · 3 comments
Assignees
Labels
bug Something isn't working triaged Issue has been triaged

Comments

@nex3
Copy link

nex3 commented Nov 2, 2022

This is the same issue as protocolbuffers/protobuf#9152, which was notionally fixed in protocolbuffers/protobuf#9156. However, it seems that as of 3.20.3 the output is (still? again?) the Jest-incompatible

var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);

For now I've rolled back to 3.11.2 which emits the compatible

var global = Function('return this')();

but this isn't a great long-term solution.

nex3 added a commit to sass/embedded-host-node that referenced this issue Nov 2, 2022
The 1.1.x line upgrades protoc to a version that suffers from
protocolbuffers/protobuf-javascript#149. It's also incompatible with
Node 12.x, although since that's out of LTS it's less of an issue.
@dibenede dibenede self-assigned this Nov 2, 2022
@dibenede
Copy link
Contributor

dibenede commented Nov 2, 2022

@nex3 Do you happen to know what aspect of the generated code is incompatible with Jest? I haven't used the framework before.

@dibenede dibenede added bug Something isn't working question Further information is requested labels Nov 2, 2022
@dibenede
Copy link
Contributor

dibenede commented Nov 3, 2022

Ah, it was right in front of me: it looks like window is the immediate issue.

@dibenede dibenede added triaged Issue has been triaged and removed question Further information is requested labels Nov 3, 2022
@lukesandberg
Copy link
Contributor

querying for globalThis first is probably reasonable typeof window != "undefined" && window would also work i suppose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Issue has been triaged
Projects
None yet
Development

No branches or pull requests

3 participants