Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -4,9 +4,9 @@
* 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';
import type { AggregatedResult } from '@jest/test-result';
import type { Test } from 'jest-runner';
import type { Context } from 'jest-runtime';
declare type Cache = {
[key: string]: [0 | 1, number];
};
@@ -46,7 +46,7 @@ export default class TestSequencer {
*
*/
sort(tests: Array<Test>): Array<Test>;
allFailedTests(tests: Array<Test>): Array<Test>;
cacheResults(tests: Array<Test>, results: AggregatedResult): void;
}
export {};
//# 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;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"}

View File

@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _fs() {
const data = _interopRequireDefault(require('fs'));
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
_fs = function _fs() {
fs = function () {
return data;
};
@@ -18,15 +18,53 @@ function _fs() {
function _jestHasteMap() {
const data = require('jest-haste-map');
_jestHasteMap = function _jestHasteMap() {
_jestHasteMap = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _defineProperty(obj, key, value) {
@@ -65,7 +103,7 @@ class TestSequencer {
}
_getCachePath(context) {
const config = context.config;
const {config} = context;
return (0, _jestHasteMap().getCacheFilePath)(
config.cacheDirectory,
'perf-cache-' + config.name
@@ -73,18 +111,18 @@ class TestSequencer {
}
_getCache(test) {
const context = test.context;
const {context} = test;
if (!this._cache.has(context) && context.config.cache) {
const cachePath = this._getCachePath(context);
if (_fs().default.existsSync(cachePath)) {
if (fs().existsSync(cachePath)) {
try {
this._cache.set(
context,
JSON.parse(_fs().default.readFileSync(cachePath, 'utf8'))
JSON.parse(fs().readFileSync(cachePath, 'utf8'))
);
} catch (e) {}
} catch {}
}
}
@@ -151,6 +189,23 @@ class TestSequencer {
});
}
allFailedTests(tests) {
const hasFailed = (cache, test) => {
var _cache$test$path;
return (
((_cache$test$path = cache[test.path]) === null ||
_cache$test$path === void 0
? void 0
: _cache$test$path[0]) === FAIL
);
};
return this.sort(
tests.filter(test => hasFailed(this._getCache(test), test))
);
}
cacheResults(tests, results) {
const map = Object.create(null);
tests.forEach(test => (map[test.path] = test));
@@ -161,16 +216,13 @@ class TestSequencer {
const perf = testResult.perfStats;
cache[testResult.testFilePath] = [
testResult.numFailingTests ? FAIL : SUCCESS,
perf.end - perf.start || 0
perf.runtime || 0
];
}
});
this._cache.forEach((cache, context) =>
_fs().default.writeFileSync(
this._getCachePath(context),
JSON.stringify(cache)
)
fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache))
);
}
}