This commit is contained in:
eric sciple 2020-01-24 12:22:34 -05:00
parent 9fff29ba6c
commit 00c3b50fca
7278 changed files with 0 additions and 1778943 deletions

View file

@ -1,23 +0,0 @@
MIT License
For Jest software
Copyright (c) 2014-present, Facebook, Inc.
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.

View file

@ -1,29 +0,0 @@
/**
* 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 { Script, Context } from 'vm';
import { Global, Config } from '@jest/types';
import { ModuleMocker } from 'jest-mock';
import { JestFakeTimers as FakeTimers } from '@jest/fake-timers';
import { JestEnvironment } from '@jest/environment';
declare type Timer = {
id: number;
ref: () => Timer;
unref: () => Timer;
};
declare class NodeEnvironment implements JestEnvironment {
context: Context | null;
fakeTimers: FakeTimers<Timer> | null;
global: Global.Global;
moduleMocker: ModuleMocker | null;
constructor(config: Config.ProjectConfig);
setup(): Promise<void>;
teardown(): Promise<void>;
runScript(script: Script): any;
}
export = NodeEnvironment;
//# sourceMappingURL=index.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAW,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,IAAI,CAAC;AACvC,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAC,cAAc,IAAI,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,aAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,KAAK,CAAC;IACjB,KAAK,EAAE,MAAM,KAAK,CAAC;CACpB,CAAC;AAEF,cAAM,eAAgB,YAAW,eAAe;IAC9C,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;gBAEtB,MAAM,EAAE,MAAM,CAAC,aAAa;IAwDxC,KAAK;IAIL,QAAQ;IAWR,SAAS,CAAC,MAAM,EAAE,MAAM;CAMzB;AAED,SAAS,eAAe,CAAC"}

View file

@ -1,153 +0,0 @@
'use strict';
function _vm() {
const data = _interopRequireDefault(require('vm'));
_vm = function _vm() {
return data;
};
return data;
}
function _jestMock() {
const data = require('jest-mock');
_jestMock = function _jestMock() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
return data;
};
return data;
}
function _fakeTimers() {
const data = require('@jest/fake-timers');
_fakeTimers = function _fakeTimers() {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
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, 'global', void 0);
_defineProperty(this, 'moduleMocker', void 0);
this.context = _vm().default.createContext();
const global = (this.global = _vm().default.runInContext(
'this',
Object.assign(this.context, config.testEnvironmentOptions)
));
global.global = global;
global.clearInterval = clearInterval;
global.clearTimeout = clearTimeout;
global.setInterval = setInterval;
global.setTimeout = setTimeout;
global.ArrayBuffer = ArrayBuffer; // URL and URLSearchParams are global in Node >= 10
if (typeof URL !== 'undefined' && typeof URLSearchParams !== 'undefined') {
/* global URL, URLSearchParams */
global.URL = URL;
global.URLSearchParams = URLSearchParams;
} // TextDecoder and TextDecoder are global in Node >= 11
if (
typeof TextEncoder !== 'undefined' &&
typeof TextDecoder !== 'undefined'
) {
/* global TextEncoder, TextDecoder */
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
}
(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()).JestFakeTimers({
config,
global,
moduleMocker: this.moduleMocker,
timerConfig
});
}
setup() {
return Promise.resolve();
}
teardown() {
if (this.fakeTimers) {
this.fakeTimers.dispose();
}
this.context = null;
this.fakeTimers = null;
return Promise.resolve();
} // TS infers the return type to be `any`, since that's what `runInContext`
// returns.
runScript(script) {
if (this.context) {
return script.runInContext(this.context);
}
return null;
}
}
module.exports = NodeEnvironment;

View file

@ -1,30 +0,0 @@
{
"name": "jest-environment-node",
"version": "24.8.0",
"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",
"dependencies": {
"@jest/environment": "^24.8.0",
"@jest/fake-timers": "^24.8.0",
"@jest/types": "^24.8.0",
"jest-mock": "^24.8.0",
"jest-util": "^24.8.0"
},
"engines": {
"node": ">= 6"
},
"publishConfig": {
"access": "public"
},
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4"
,"_resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.8.0.tgz"
,"_integrity": "sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q=="
,"_from": "jest-environment-node@24.8.0"
}

View file

@ -1,14 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "build",
"rootDir": "src"
},
"references": [
{"path": "../jest-environment"},
{"path": "../jest-fake-timers"},
{"path": "../jest-mock"},
{"path": "../jest-types"},
{"path": "../jest-util"}
]
}