Skip to content

Commit

Permalink
Fix standalone tests in old node
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Aug 2, 2023
1 parent 2f30e87 commit 7ca8ccc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/babel-standalone/test/helpers/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ export function setup() {
// "polyfill" when releasing Babel 7 to make sure that we do not accidentally
// bundle Chalk 5.

if (!process.env.IS_PUBLISH || process.env.BABEL_8_BREAKING) {
if (process.env.BABEL_8_BREAKING) {
globalThis.navigator = {};
} else if (!process.env.IS_PUBLISH) {
global.navigator = {};
}
}

export function teardown() {
if (!process.env.IS_PUBLISH || process.env.BABEL_8_BREAKING) {
if (process.env.BABEL_8_BREAKING) {
delete globalThis.navigator;
} else if (!process.env.IS_PUBLISH) {
delete global.navigator;
}
}

0 comments on commit 7ca8ccc

Please sign in to comment.