bump jest and make tests pass

This commit is contained in:
Louis Hache committed 2020-11-13 19:11:55 +01:00
1 parent d28dc26fa3
commit 4f58d166b7
5769 files changed
+856618 -394571

No files matched your search

+1 -2
View File
@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Options } from 'yargs';
import type { Options } from 'yargs';
export declare const usage = "Usage: $0 [--config=<pathToConfigFile>] <file>";
export declare const options: Record<'cache' | 'config' | 'debug' | 'version' | 'watchman', Options>;
//# sourceMappingURL=args.d.ts.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAE9B,eAAO,MAAM,KAAK,mDAAmD,CAAC;AAEtE,eAAO,MAAM,OAAO,EAAE,MAAM,CAC1B,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,EACrD,OAAO,CA8BR,CAAC"}
+2 -3
View File
@@ -4,6 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
export declare function run(cliArgv?: Config.Argv, cliInfo?: Array<string>): void;
//# sourceMappingURL=index.d.ts.map
import type { Config } from '@jest/types';
export declare function run(cliArgv?: Config.Argv, cliInfo?: Array<string>): Promise<void>;
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAUnC,wBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,QA+EjE"}
+156 -147
View File
@@ -6,19 +6,19 @@ Object.defineProperty(exports, '__esModule', {
exports.run = run;
function _os() {
const data = _interopRequireDefault(require('os'));
const data = require('os');
_os = function _os() {
_os = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require('path'));
function path() {
const data = _interopRequireWildcard(require('path'));
_path = function _path() {
path = function () {
return data;
};
@@ -28,17 +28,7 @@ function _path() {
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
_realpathNative = function _realpathNative() {
_chalk = function () {
return data;
};
@@ -48,7 +38,7 @@ function _realpathNative() {
function _yargs() {
const data = _interopRequireDefault(require('yargs'));
_yargs = function _yargs() {
_yargs = function () {
return data;
};
@@ -58,27 +48,7 @@ function _yargs() {
function _console() {
const data = require('@jest/console');
_console = function _console() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function _jestValidate() {
_console = function () {
return data;
};
@@ -88,84 +58,98 @@ function _jestValidate() {
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function _jestConfig() {
_jestConfig = function () {
return data;
};
return data;
}
var _version = require('../version');
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _jestValidate() {
const data = require('jest-validate');
_jestValidate = function () {
return data;
};
return data;
}
function _version() {
const data = require('../version');
_version = function () {
return data;
};
return data;
}
var args = _interopRequireWildcard(require('./args'));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc =
Object.defineProperty && Object.getOwnPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
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];
}
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
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;
}
function run(cliArgv, cliInfo) {
const realFs = require('fs');
const fs = require('graceful-fs');
fs.gracefulify(realFs);
/**
* 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.
*/
async function run(cliArgv, cliInfo) {
let argv;
if (cliArgv) {
@@ -175,14 +159,11 @@ function run(cliArgv, cliInfo) {
.default.usage(args.usage)
.help(false)
.version(false)
.options(args.options).argv; // @ts-ignore: fix this at some point
(0, _jestValidate().validateCLIOptions)(
argv,
_objectSpread({}, args.options, {
deprecationEntries: _jestConfig().deprecationEntries
})
);
.options(args.options).argv;
(0, _jestValidate().validateCLIOptions)(argv, {
...args.options,
deprecationEntries: _jestConfig().deprecationEntries
});
}
if (argv.help) {
@@ -193,7 +174,7 @@ function run(cliArgv, cliInfo) {
}
if (argv.version) {
console.log(`v${_version.VERSION}\n`);
console.log(`v${_version().VERSION}\n`);
return;
}
@@ -203,54 +184,82 @@ function run(cliArgv, cliInfo) {
return;
}
const root = (0, _realpathNative().sync)(process.cwd());
const filePath = _path().default.resolve(root, argv._[0]);
const root = (0, _jestUtil().tryRealpath)(process.cwd());
const filePath = path().resolve(root, argv._[0]);
if (argv.debug) {
const info = cliInfo ? ', ' + cliInfo.join(', ') : '';
console.log(`Using Jest Runtime v${_version.VERSION}${info}`);
} // TODO: Figure this out
// @ts-ignore: this might not have the correct arguments
console.log(`Using Jest Runtime v${_version().VERSION}${info}`);
}
const options = (0, _jestConfig().readConfig)(argv, root);
const options = await (0, _jestConfig().readConfig)(argv, root);
const globalConfig = options.globalConfig; // Always disable automocking in scripts.
const config = _objectSpread({}, options.projectConfig, {
automock: false,
unmockedModulePathPatterns: null
}); // Break circular dependency
const config = {...options.projectConfig, automock: false};
const Runtime = require('..');
Runtime.createContext(config, {
maxWorkers: Math.max(_os().default.cpus().length - 1, 1),
watchman: globalConfig.watchman
})
.then(hasteMap => {
const Environment = require(config.testEnvironment);
try {
var _runtime$unstable_sho2;
const environment = new Environment(config);
(0, _jestUtil().setGlobal)(
environment.global,
'console',
new (_console()).CustomConsole(process.stdout, process.stderr)
);
(0, _jestUtil().setGlobal)(
environment.global,
'jestProjectConfig',
config
);
(0, _jestUtil().setGlobal)(
environment.global,
'jestGlobalConfig',
globalConfig
);
const runtime = new Runtime(config, environment, hasteMap.resolver);
runtime.requireModule(filePath);
})
.catch(e => {
console.error(_chalk().default.red(e.stack || e));
process.on('exit', () => (process.exitCode = 1));
const hasteMap = await Runtime.createContext(config, {
maxWorkers: Math.max((0, _os().cpus)().length - 1, 1),
watchman: globalConfig.watchman
});
const Environment = require(config.testEnvironment);
const environment = new Environment(config);
(0, _jestUtil().setGlobal)(
environment.global,
'console',
new (_console().CustomConsole)(process.stdout, process.stderr)
);
(0, _jestUtil().setGlobal)(environment.global, 'jestProjectConfig', config);
(0, _jestUtil().setGlobal)(
environment.global,
'jestGlobalConfig',
globalConfig
);
const runtime = new Runtime(
config,
environment,
hasteMap.resolver,
undefined,
undefined,
filePath
);
for (const path of config.setupFiles) {
var _runtime$unstable_sho;
// TODO: remove ? in Jest 26
const esm =
(_runtime$unstable_sho = runtime.unstable_shouldLoadAsEsm) === null ||
_runtime$unstable_sho === void 0
? void 0
: _runtime$unstable_sho.call(runtime, path);
if (esm) {
await runtime.unstable_importModule(path);
} else {
runtime.requireModule(path);
}
} // TODO: remove ? in Jest 26
const esm =
(_runtime$unstable_sho2 = runtime.unstable_shouldLoadAsEsm) === null ||
_runtime$unstable_sho2 === void 0
? void 0
: _runtime$unstable_sho2.call(runtime, filePath);
if (esm) {
await runtime.unstable_importModule(filePath);
} else {
runtime.requireModule(filePath);
}
} catch (e) {
console.error(_chalk().default.red(e.stack || e));
process.on('exit', () => (process.exitCode = 1));
}
}