aboutsummaryrefslogtreecommitdiff
path: root/node_modules/jest-environment-node
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/jest-environment-node
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/jest-environment-node')
-rw-r--r--node_modules/jest-environment-node/LICENSE21
-rw-r--r--node_modules/jest-environment-node/build/index.d.ts29
-rw-r--r--node_modules/jest-environment-node/build/index.js184
-rw-r--r--node_modules/jest-environment-node/package.json37
4 files changed, 271 insertions, 0 deletions
diff --git a/node_modules/jest-environment-node/LICENSE b/node_modules/jest-environment-node/LICENSE
new file mode 100644
index 0000000..b96dcb0
--- /dev/null
+++ b/node_modules/jest-environment-node/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) Facebook, Inc. and its affiliates.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/jest-environment-node/build/index.d.ts b/node_modules/jest-environment-node/build/index.d.ts
new file mode 100644
index 0000000..0b77790
--- /dev/null
+++ b/node_modules/jest-environment-node/build/index.d.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+/// <reference types="node" />
+import { Context } from 'vm';
+import type { JestEnvironment } from '@jest/environment';
+import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
+import type { Config, Global } from '@jest/types';
+import { ModuleMocker } from 'jest-mock';
+declare type Timer = {
+ id: number;
+ ref: () => Timer;
+ unref: () => Timer;
+};
+declare class NodeEnvironment implements JestEnvironment<Timer> {
+ context: Context | null;
+ fakeTimers: LegacyFakeTimers<Timer> | null;
+ fakeTimersModern: ModernFakeTimers | null;
+ global: Global.Global;
+ moduleMocker: ModuleMocker | null;
+ constructor(config: Config.ProjectConfig);
+ setup(): Promise<void>;
+ teardown(): Promise<void>;
+ getVmContext(): Context | null;
+}
+export = NodeEnvironment;
diff --git a/node_modules/jest-environment-node/build/index.js b/node_modules/jest-environment-node/build/index.js
new file mode 100644
index 0000000..64904cb
--- /dev/null
+++ b/node_modules/jest-environment-node/build/index.js
@@ -0,0 +1,184 @@
+'use strict';
+
+function _vm() {
+ const data = require('vm');
+
+ _vm = function () {
+ return data;
+ };
+
+ return data;
+}
+
+function _fakeTimers() {
+ const data = require('@jest/fake-timers');
+
+ _fakeTimers = function () {
+ return data;
+ };
+
+ return data;
+}
+
+function _jestMock() {
+ const data = require('jest-mock');
+
+ _jestMock = function () {
+ return data;
+ };
+
+ return data;
+}
+
+function _jestUtil() {
+ const data = require('jest-util');
+
+ _jestUtil = function () {
+ return data;
+ };
+
+ return data;
+}
+
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+ return obj;
+}
+
+class NodeEnvironment {
+ constructor(config) {
+ _defineProperty(this, 'context', void 0);
+
+ _defineProperty(this, 'fakeTimers', void 0);
+
+ _defineProperty(this, 'fakeTimersModern', void 0);
+
+ _defineProperty(this, 'global', void 0);
+
+ _defineProperty(this, 'moduleMocker', void 0);
+
+ this.context = (0, _vm().createContext)();
+ const global = (this.global = (0, _vm().runInContext)(
+ 'this',
+ Object.assign(this.context, config.testEnvironmentOptions)
+ ));
+ global.global = global;
+ global.clearInterval = clearInterval;
+ global.clearTimeout = clearTimeout;
+ global.setInterval = setInterval;
+ global.setTimeout = setTimeout;
+ global.Buffer = Buffer;
+ global.setImmediate = setImmediate;
+ global.clearImmediate = clearImmediate;
+ global.ArrayBuffer = ArrayBuffer; // TextEncoder (global or via 'util') references a Uint8Array constructor
+ // different than the global one used by users in tests. This makes sure the
+ // same constructor is referenced by both.
+
+ global.Uint8Array = Uint8Array; // URL and URLSearchParams are global in Node >= 10
+
+ if (typeof URL !== 'undefined' && typeof URLSearchParams !== 'undefined') {
+ global.URL = URL;
+ global.URLSearchParams = URLSearchParams;
+ } // TextDecoder and TextDecoder are global in Node >= 11
+
+ if (
+ typeof TextEncoder !== 'undefined' &&
+ typeof TextDecoder !== 'undefined'
+ ) {
+ global.TextEncoder = TextEncoder;
+ global.TextDecoder = TextDecoder;
+ } // queueMicrotask is global in Node >= 11
+
+ if (typeof queueMicrotask !== 'undefined') {
+ global.queueMicrotask = queueMicrotask;
+ } // AbortController is global in Node >= 15
+
+ if (typeof AbortController !== 'undefined') {
+ global.AbortController = AbortController;
+ } // AbortSignal is global in Node >= 15
+
+ if (typeof AbortSignal !== 'undefined') {
+ global.AbortSignal = AbortSignal;
+ } // Event is global in Node >= 15.4
+
+ if (typeof Event !== 'undefined') {
+ global.Event = Event;
+ } // EventTarget is global in Node >= 15.4
+
+ if (typeof EventTarget !== 'undefined') {
+ global.EventTarget = EventTarget;
+ } // performance is global in Node >= 16
+
+ if (typeof performance !== 'undefined') {
+ global.performance = performance;
+ } // atob and btoa are global in Node >= 16
+
+ if (typeof atob !== 'undefined' && typeof btoa !== 'undefined') {
+ global.atob = atob;
+ global.btoa = btoa;
+ }
+
+ (0, _jestUtil().installCommonGlobals)(global, config.globals);
+ this.moduleMocker = new (_jestMock().ModuleMocker)(global);
+
+ const timerIdToRef = id => ({
+ id,
+
+ ref() {
+ return this;
+ },
+
+ unref() {
+ return this;
+ }
+ });
+
+ const timerRefToId = timer => (timer && timer.id) || undefined;
+
+ const timerConfig = {
+ idToRef: timerIdToRef,
+ refToId: timerRefToId
+ };
+ this.fakeTimers = new (_fakeTimers().LegacyFakeTimers)({
+ config,
+ global,
+ moduleMocker: this.moduleMocker,
+ timerConfig
+ });
+ this.fakeTimersModern = new (_fakeTimers().ModernFakeTimers)({
+ config,
+ global
+ });
+ }
+
+ async setup() {}
+
+ async teardown() {
+ if (this.fakeTimers) {
+ this.fakeTimers.dispose();
+ }
+
+ if (this.fakeTimersModern) {
+ this.fakeTimersModern.dispose();
+ }
+
+ this.context = null;
+ this.fakeTimers = null;
+ this.fakeTimersModern = null;
+ }
+
+ getVmContext() {
+ return this.context;
+ }
+}
+
+module.exports = NodeEnvironment;
diff --git a/node_modules/jest-environment-node/package.json b/node_modules/jest-environment-node/package.json
new file mode 100644
index 0000000..02ce116
--- /dev/null
+++ b/node_modules/jest-environment-node/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "jest-environment-node",
+ "version": "27.5.1",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/facebook/jest.git",
+ "directory": "packages/jest-environment-node"
+ },
+ "license": "MIT",
+ "main": "./build/index.js",
+ "types": "./build/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./build/index.d.ts",
+ "default": "./build/index.js"
+ },
+ "./package.json": "./package.json"
+ },
+ "dependencies": {
+ "@jest/environment": "^27.5.1",
+ "@jest/fake-timers": "^27.5.1",
+ "@jest/types": "^27.5.1",
+ "@types/node": "*",
+ "jest-mock": "^27.5.1",
+ "jest-util": "^27.5.1"
+ },
+ "devDependencies": {
+ "@jest/test-utils": "^27.5.1"
+ },
+ "engines": {
+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850"
+}