Skip to content

Commit

Permalink
Merge branch 'TurboWarp:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyMakesThings authored Feb 10, 2024
2 parents 1c7c260 + 9622516 commit 5af40c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions test/unit/tw_sandboxed_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ global.fetch = (url, options = {}) => (
Promise.resolve(`[Response ${url instanceof Request ? url.url : url} options=${JSON.stringify(options)}]`)
);

// Remove navigator object from Node 21 and later
delete global.navigator;

// Need to trick the extension API to think it's running in a worker
// It will not actually use this object ever.
global.self = {};
Expand Down
9 changes: 6 additions & 3 deletions test/unit/tw_translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ global.fetch = () => Promise.reject(new Error('Simulated network error'));

const Scratch3TranslateBlocks = require('../../src/extensions/scratch3_translate/index');

global.navigator = {
language: 'en'
};
// Node 21 and later defines a navigator object, but we want to override that for the test
Object.defineProperty(global, 'navigator', {
value: {
language: 'en-US'
}
});

// Translate tries to access AbortController from window, but does not require it to exist.
global.window = {};
Expand Down
3 changes: 3 additions & 0 deletions test/unit/tw_unsandboxed_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ global.window = {
open: (url, target, features) => `[Window ${url} target=${target || ''} features=${features || ''}]`
};

// Remove navigator object from Node 21 and later
delete global.navigator;

tap.beforeEach(() => {
scriptCallbacks.clear();
global.location = {
Expand Down

0 comments on commit 5af40c6

Please sign in to comment.