From a9ff1e270c74225ac36848f3b59357902beaa7c5 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 28 Sep 2023 09:16:35 +0200 Subject: [PATCH] fix: overwrite global URL with environment's (#4164) --- packages/vitest/src/integrations/env/utils.ts | 1 - test/core/test/environments/node.spec.ts | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/core/test/environments/node.spec.ts diff --git a/packages/vitest/src/integrations/env/utils.ts b/packages/vitest/src/integrations/env/utils.ts index 640a2be9f2a4..230f1f2bbd55 100644 --- a/packages/vitest/src/integrations/env/utils.ts +++ b/packages/vitest/src/integrations/env/utils.ts @@ -5,7 +5,6 @@ const skipKeys = [ 'self', 'top', 'parent', - 'URL', ] export function getWindowKeys(global: any, win: any) { diff --git a/test/core/test/environments/node.spec.ts b/test/core/test/environments/node.spec.ts new file mode 100644 index 000000000000..bae933b50ca2 --- /dev/null +++ b/test/core/test/environments/node.spec.ts @@ -0,0 +1,11 @@ +// @vitest-environment node + +import { expect, test } from 'vitest' + +const nodeMajor = Number(process.version.slice(1).split('.')[0]) + +test.runIf(nodeMajor > 16)('url correctly creates an object', () => { + expect(() => { + URL.createObjectURL(new Blob([])) + }).not.toThrow() +})