This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

23
node_modules/@jest/test-sequencer/LICENSE generated vendored Normal file
View file

@ -0,0 +1,23 @@
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.

52
node_modules/@jest/test-sequencer/build/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,52 @@
/**
* 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.
*/
import { AggregatedResult } from '@jest/test-result';
import { Context } from 'jest-runtime';
import { Test } from 'jest-runner';
declare type Cache = {
[key: string]: [0 | 1, number];
};
/**
* The TestSequencer will ultimately decide which tests should run first.
* It is responsible for storing and reading from a local cache
* map that stores context information for a given test, such as how long it
* took to run during the last run and if it has failed or not.
* Such information is used on:
* TestSequencer.sort(tests: Array<Test>)
* to sort the order of the provided tests.
*
* After the results are collected,
* TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult)
* is called to store/update this information on the cache map.
*/
export default class TestSequencer {
private _cache;
_getCachePath(context: Context): string;
_getCache(test: Test): Cache;
/**
* Sorting tests is very important because it has a great impact on the
* user-perceived responsiveness and speed of the test run.
*
* If such information is on cache, tests are sorted based on:
* -> Has it failed during the last run ?
* Since it's important to provide the most expected feedback as quickly
* as possible.
* -> How long it took to run ?
* Because running long tests first is an effort to minimize worker idle
* time at the end of a long test run.
* And if that information is not available they are sorted based on file size
* since big test files usually take longer to complete.
*
* Note that a possible improvement would be to analyse other information
* from the file other than its size.
*
*/
sort(tests: Array<Test>): Array<Test>;
cacheResults(tests: Array<Test>, results: AggregatedResult): void;
}
export {};
//# sourceMappingURL=index.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAKjC,aAAK,KAAK,GAAG;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAkC;IAEhD,aAAa,CAAC,OAAO,EAAE,OAAO;IAK9B,SAAS,CAAC,IAAI,EAAE,IAAI;IAuBpB;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IA6BrC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,gBAAgB;CAkB3D"}

178
node_modules/@jest/test-sequencer/build/index.js generated vendored Normal file
View file

@ -0,0 +1,178 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _fs() {
const data = _interopRequireDefault(require('fs'));
_fs = function _fs() {
return data;
};
return data;
}
function _jestHasteMap() {
const data = require('jest-haste-map');
_jestHasteMap = function _jestHasteMap() {
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;
}
const FAIL = 0;
const SUCCESS = 1;
/**
* The TestSequencer will ultimately decide which tests should run first.
* It is responsible for storing and reading from a local cache
* map that stores context information for a given test, such as how long it
* took to run during the last run and if it has failed or not.
* Such information is used on:
* TestSequencer.sort(tests: Array<Test>)
* to sort the order of the provided tests.
*
* After the results are collected,
* TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult)
* is called to store/update this information on the cache map.
*/
class TestSequencer {
constructor() {
_defineProperty(this, '_cache', new Map());
}
_getCachePath(context) {
const config = context.config;
return (0, _jestHasteMap().getCacheFilePath)(
config.cacheDirectory,
'perf-cache-' + config.name
);
}
_getCache(test) {
const context = test.context;
if (!this._cache.has(context) && context.config.cache) {
const cachePath = this._getCachePath(context);
if (_fs().default.existsSync(cachePath)) {
try {
this._cache.set(
context,
JSON.parse(_fs().default.readFileSync(cachePath, 'utf8'))
);
} catch (e) {}
}
}
let cache = this._cache.get(context);
if (!cache) {
cache = {};
this._cache.set(context, cache);
}
return cache;
}
/**
* Sorting tests is very important because it has a great impact on the
* user-perceived responsiveness and speed of the test run.
*
* If such information is on cache, tests are sorted based on:
* -> Has it failed during the last run ?
* Since it's important to provide the most expected feedback as quickly
* as possible.
* -> How long it took to run ?
* Because running long tests first is an effort to minimize worker idle
* time at the end of a long test run.
* And if that information is not available they are sorted based on file size
* since big test files usually take longer to complete.
*
* Note that a possible improvement would be to analyse other information
* from the file other than its size.
*
*/
sort(tests) {
const stats = {};
const fileSize = ({path, context: {hasteFS}}) =>
stats[path] || (stats[path] = hasteFS.getSize(path) || 0);
const hasFailed = (cache, test) =>
cache[test.path] && cache[test.path][0] === FAIL;
const time = (cache, test) => cache[test.path] && cache[test.path][1];
tests.forEach(test => (test.duration = time(this._getCache(test), test)));
return tests.sort((testA, testB) => {
const cacheA = this._getCache(testA);
const cacheB = this._getCache(testB);
const failedA = hasFailed(cacheA, testA);
const failedB = hasFailed(cacheB, testB);
const hasTimeA = testA.duration != null;
if (failedA !== failedB) {
return failedA ? -1 : 1;
} else if (hasTimeA != (testB.duration != null)) {
// If only one of two tests has timing information, run it last
return hasTimeA ? 1 : -1;
} else if (testA.duration != null && testB.duration != null) {
return testA.duration < testB.duration ? 1 : -1;
} else {
return fileSize(testA) < fileSize(testB) ? 1 : -1;
}
});
}
cacheResults(tests, results) {
const map = Object.create(null);
tests.forEach(test => (map[test.path] = test));
results.testResults.forEach(testResult => {
if (testResult && map[testResult.testFilePath] && !testResult.skipped) {
const cache = this._getCache(map[testResult.testFilePath]);
const perf = testResult.perfStats;
cache[testResult.testFilePath] = [
testResult.numFailingTests ? FAIL : SUCCESS,
perf.end - perf.start || 0
];
}
});
this._cache.forEach((cache, context) =>
_fs().default.writeFileSync(
this._getCachePath(context),
JSON.stringify(cache)
)
);
}
}
exports.default = TestSequencer;

55
node_modules/@jest/test-sequencer/package.json generated vendored Normal file
View file

@ -0,0 +1,55 @@
{
"_from": "@jest/test-sequencer@^24.8.0",
"_id": "@jest/test-sequencer@24.8.0",
"_inBundle": false,
"_integrity": "sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg==",
"_location": "/@jest/test-sequencer",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@jest/test-sequencer@^24.8.0",
"name": "@jest/test-sequencer",
"escapedName": "@jest%2ftest-sequencer",
"scope": "@jest",
"rawSpec": "^24.8.0",
"saveSpec": null,
"fetchSpec": "^24.8.0"
},
"_requiredBy": [
"/jest-config"
],
"_resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz",
"_shasum": "2f993bcf6ef5eb4e65e8233a95a3320248cf994b",
"_spec": "@jest/test-sequencer@^24.8.0",
"_where": "E:\\github\\setup-java\\node_modules\\jest-config",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"bundleDependencies": false,
"dependencies": {
"@jest/test-result": "^24.8.0",
"jest-haste-map": "^24.8.0",
"jest-runner": "^24.8.0",
"jest-runtime": "^24.8.0"
},
"deprecated": false,
"engines": {
"node": ">= 6"
},
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
"name": "@jest/test-sequencer",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git",
"directory": "packages/jest-test-sequencer"
},
"types": "build/index.d.ts",
"version": "24.8.0"
}

13
node_modules/@jest/test-sequencer/tsconfig.json generated vendored Normal file
View file

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
},
"references": [
{"path": "../jest-haste-map"},
{"path": "../jest-runner"},
{"path": "../jest-test-result"},
{"path": "../jest-types"}
]
}

2938
node_modules/@jest/test-sequencer/tsconfig.tsbuildinfo generated vendored Normal file

File diff suppressed because it is too large Load diff