From d7005c22c45d17ce5c3864e4ed363bed2df99d65 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sun, 3 Sep 2023 11:39:21 +0200 Subject: [PATCH] ci: use Node.js globals --- package.json | 10 +--------- test/browser-globals.js | 33 --------------------------------- test/clients.js | 2 -- 3 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 test/browser-globals.js diff --git a/package.json b/package.json index 2a87b0a..8884143 100644 --- a/package.json +++ b/package.json @@ -56,22 +56,15 @@ "@rollup/plugin-node-resolve": "latest", "@rollup/plugin-replace": "latest", "@rollup/plugin-terser": "latest", - "abort-controller": "latest", "async-listen": "latest", "ava": "3", - "beauty-error": "latest", "c8": "latest", - "chalk": "latest", "ci-publish": "latest", "conventional-github-releaser": "latest", - "eachdir": "latest", "esm": "latest", - "exists-file": "latest", "git-authors-cli": "latest", "ky": "latest", - "meow": "latest", "nano-staged": "latest", - "node-fetch": "2", "npm-check-updates": "latest", "prettier-standard": "latest", "rollup": "latest", @@ -82,8 +75,7 @@ "standard-markdown": "latest", "standard-version": "latest", "stream-to-promise": "latest", - "tsd": "latest", - "web-streams-polyfill": "latest" + "tsd": "latest" }, "engines": { "node": ">= 12" diff --git a/test/browser-globals.js b/test/browser-globals.js deleted file mode 100644 index ae02a16..0000000 --- a/test/browser-globals.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -const fetch = require('node-fetch') - -const AbortController = require('abort-controller') - -const TEN_MEGABYTES = 1000 * 1000 * 10 - -if (!global.fetch) { - global.fetch = (url, options) => fetch(url, { highWaterMark: TEN_MEGABYTES, ...options }) -} - -if (!global.Headers) { - global.Headers = fetch.Headers -} - -if (!global.Request) { - global.Request = fetch.Request -} - -if (!global.Response) { - global.Response = fetch.Response -} - -if (!global.AbortController) { - global.AbortController = AbortController -} - -if (!global.ReadableStream) { - try { - global.ReadableStream = require('web-streams-polyfill/ponyfill/es2018') - } catch (_) {} -} diff --git a/test/clients.js b/test/clients.js index 9e83ac0..13ce282 100644 --- a/test/clients.js +++ b/test/clients.js @@ -1,5 +1,3 @@ -import './browser-globals' - import mqlLightweight from '../src/lightweight' import mqlNode from '../src/node'