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

jest-environment-node: add atob and btoa #12269

Merged
merged 4 commits into from Jan 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/jest-environment-node/src/index.ts
Expand Up @@ -82,6 +82,13 @@ class NodeEnvironment implements JestEnvironment<Timer> {
if (typeof performance !== 'undefined') {
global.performance = performance;
}
if (
typeof atob !== 'undefined' &&
Copy link

Choose a reason for hiding this comment

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

Should we add a comment here that it is available in node 16 like it was done above?

typeof btoa !== 'undefined'
) {
global.atob = atob;
global.btoa = btoa;
}
installCommonGlobals(global, config.globals);

this.moduleMocker = new ModuleMocker(global);
Expand Down