initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

38
node_modules/babel-plugin-jest-hoist/README.md generated vendored Normal file
View File

@@ -0,0 +1,38 @@
# babel-plugin-jest-hoist
Babel plugin to hoist `jest.disableAutomock`, `jest.enableAutomock`,
`jest.unmock`, `jest.mock`, calls above `import` statements. This plugin is
automatically included when using
[babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest).
## Installation
```sh
$ yarn add --dev babel-plugin-jest-hoist
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["jest-hoist"]
}
```
### Via CLI
```sh
$ babel --plugins jest-hoist script.js
```
### Via Node API
```javascript
require('babel-core').transform('code', {
plugins: ['jest-hoist'],
});
```

144
node_modules/babel-plugin-jest-hoist/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,144 @@
'use strict';
/**
* Copyright (c) 2014-present, Facebook, Inc. 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.
*
*
*/
function invariant(condition, message) {
if (!condition) {
throw new Error('babel-plugin-jest-hoist: ' + message);
}
}
// We allow `jest`, `expect`, `require`, all default Node.js globals and all
// ES2015 built-ins to be used inside of a `jest.mock` factory.
// We also allow variables prefixed with `mock` as an escape-hatch.
const WHITELISTED_IDENTIFIERS = {
Array: true,
ArrayBuffer: true,
Boolean: true,
DataView: true,
Date: true,
Error: true,
EvalError: true,
Float32Array: true,
Float64Array: true,
Function: true,
Generator: true,
GeneratorFunction: true,
Infinity: true,
Int16Array: true,
Int32Array: true,
Int8Array: true,
InternalError: true,
Intl: true,
JSON: true,
Map: true,
Math: true,
NaN: true,
Number: true,
Object: true,
Promise: true,
Proxy: true,
RangeError: true,
ReferenceError: true,
Reflect: true,
RegExp: true,
Set: true,
String: true,
Symbol: true,
SyntaxError: true,
TypeError: true,
URIError: true,
Uint16Array: true,
Uint32Array: true,
Uint8Array: true,
Uint8ClampedArray: true,
WeakMap: true,
WeakSet: true,
arguments: true,
console: true,
expect: true,
jest: true,
require: true,
undefined: true
};
Object.keys(global).forEach(name => WHITELISTED_IDENTIFIERS[name] = true);
const JEST_GLOBAL = { name: 'jest' };
const IDVisitor = {
ReferencedIdentifier(path) {
this.ids.add(path);
},
blacklist: ['TypeAnnotation']
};
const FUNCTIONS = Object.create(null);
FUNCTIONS.mock = args => {
if (args.length === 1) {
return args[0].isStringLiteral() || args[0].isLiteral();
} else if (args.length === 2 || args.length === 3) {
const moduleFactory = args[1];
invariant(moduleFactory.isFunction(), 'The second argument of `jest.mock` must be an inline function.');
const ids = new Set();
const parentScope = moduleFactory.parentPath.scope;
moduleFactory.traverse(IDVisitor, { ids });
for (const id of ids) {
const name = id.node.name;
let found = false;
let scope = id.scope;
while (scope !== parentScope) {
if (scope.bindings[name]) {
found = true;
break;
}
scope = scope.parent;
}
if (!found) {
invariant(scope.hasGlobal(name) && WHITELISTED_IDENTIFIERS[name] || /^mock/.test(name) ||
// Allow istanbul's coverage variable to pass.
/^(?:__)?cov/.test(name), 'The module factory of `jest.mock()` is not allowed to ' + 'reference any out-of-scope variables.\n' + 'Invalid variable access: ' + name + '\n' + 'Whitelisted objects: ' + Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.\n' + 'Note: This is a precaution to guard against uninitialized mock ' + 'variables. If it is ensured that the mock is required lazily, ' + 'variable names prefixed with `mock` are permitted.');
}
}
return true;
}
return false;
};
FUNCTIONS.unmock = args => args.length === 1 && args[0].isStringLiteral();
FUNCTIONS.deepUnmock = args => args.length === 1 && args[0].isStringLiteral();
FUNCTIONS.disableAutomock = FUNCTIONS.enableAutomock = args => args.length === 0;
module.exports = () => {
const isJest = callee => callee.get('object').isIdentifier(JEST_GLOBAL) || callee.isMemberExpression() && isJest(callee.get('object'));
const shouldHoistExpression = expr => {
if (!expr.isCallExpression()) {
return false;
}
const callee = expr.get('callee');
const object = callee.get('object');
const property = callee.get('property');
return property.isIdentifier() && FUNCTIONS[property.node.name] && (object.isIdentifier(JEST_GLOBAL) || callee.isMemberExpression() && shouldHoistExpression(object)) && FUNCTIONS[property.node.name](expr.get('arguments'));
};
return {
visitor: {
ExpressionStatement(path) {
if (shouldHoistExpression(path.get('expression'))) {
path.node._blockHoist = Infinity;
}
}
}
};
};

88
node_modules/babel-plugin-jest-hoist/package.json generated vendored Normal file
View File

@@ -0,0 +1,88 @@
{
"_args": [
[
"babel-plugin-jest-hoist@^22.4.4",
"/home/bernhard/freifunk-app/node_modules/babel-preset-jest"
]
],
"_from": "babel-plugin-jest-hoist@>=22.4.4 <23.0.0",
"_id": "babel-plugin-jest-hoist@22.4.4",
"_inCache": true,
"_installable": true,
"_location": "/babel-plugin-jest-hoist",
"_nodeVersion": "8.9.1",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/babel-plugin-jest-hoist_22.4.4_1526648324779_0.48861573617028187"
},
"_npmUser": {
"email": "mjesun@hotmail.com",
"name": "mjesun"
},
"_npmVersion": "5.5.1",
"_phantomChildren": {},
"_requested": {
"name": "babel-plugin-jest-hoist",
"raw": "babel-plugin-jest-hoist@^22.4.4",
"rawSpec": "^22.4.4",
"scope": null,
"spec": ">=22.4.4 <23.0.0",
"type": "range"
},
"_requiredBy": [
"/babel-preset-jest"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.4.tgz",
"_shasum": "b9851906eab34c7bf6f8c895a2b08bea1a844c0b",
"_shrinkwrap": null,
"_spec": "babel-plugin-jest-hoist@^22.4.4",
"_where": "/home/bernhard/freifunk-app/node_modules/babel-preset-jest",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"dependencies": {},
"description": "Babel plugin to hoist `jest.disableAutomock`, `jest.enableAutomock`, `jest.unmock`, `jest.mock`, calls above `import` statements. This plugin is automatically included when using [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jes",
"devDependencies": {},
"directories": {},
"dist": {
"fileCount": 3,
"integrity": "sha512-DUvGfYaAIlkdnygVIEl0O4Av69NtuQWcrjMOv6DODPuhuGLDnbsARz3AwiiI/EkIMMlxQDUcrZ9yoyJvTNjcVQ==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/s4FCRA9TVsSAnZWagAAjewP/Ajm7ziUFKVxf6LGoytX\nf4KJjaFGbGfXiHUVLbY/N0F3YqForVm1XUdzjpJ0OkPPh+yTK4HbWwlZTnPV\n9SbMffFT1Msbs0LiXZQMLOQBI45YbCVvaPx6hp4X6AFivx+4RKBJM85YE9Ru\nIOkPlqibco4Z8Nzz7p+pfq5iAObjU3VJ4MyORUxnxPuVjqJ3o0qxV8pkSrj4\nixS5X1NIA0gEHUPjUE1Xpe//0vUIB5IxBalkNtR9OviY0U3Amn8CF07WwIib\nxcgNC0LMEcjhuKNa2Nvf1jrrWCmpVCQJFkvV74TnNqVf9eanXDgAWfqCqHr+\nUvP1jkZRTm+G+XPkwogMrc43N9rL7FO8jgKOCG4jhvOUfPMiJPBbZLy1SBue\nABtoiA71lMe3sI29cJ1OF3YWohrPdj6hEsWHbR1/CPnyU1/cIaAm97OCyKBE\nlmxL1S6b8hntA5DBVHukNrjm3dIp5MjUjijErTLPCHjChaernCJVlPf18CeW\njiKwG2H3TXLrc6QDL2HR1kf6jDng/Na/cKKG6IIOi4q0bmB2wEtFedC25zio\nVPCtYlTgACtRtzTKQgVFPPj61exrBP0dKDQqs4QLmIO40Ty6eWCA84ZODKU6\nEInFUI0ysF6ln0it1qND5KrJGYYiLHHzQxmicefbcQ/3gxseO70MRgNQ/qq7\nqC8W\r\n=WOEJ\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "b9851906eab34c7bf6f8c895a2b08bea1a844c0b",
"tarball": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.4.tgz",
"unpackedSize": 5036
},
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
"maintainers": [
{
"name": "aaronabramov",
"email": "aaron@abramov.io"
},
{
"name": "cpojer",
"email": "christoph.pojer@gmail.com"
},
{
"name": "fb",
"email": "opensource+npm@fb.com"
},
{
"name": "jeanlauliac",
"email": "jean@lauliac.com"
},
{
"name": "mjesun",
"email": "mjesun@hotmail.com"
}
],
"name": "babel-plugin-jest-hoist",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git"
},
"version": "22.4.4"
}