diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/jest-runner/build/testWorker.js | |
parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/jest-runner/build/testWorker.js')
-rw-r--r-- | node_modules/jest-runner/build/testWorker.js | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/node_modules/jest-runner/build/testWorker.js b/node_modules/jest-runner/build/testWorker.js new file mode 100644 index 0000000..2345443 --- /dev/null +++ b/node_modules/jest-runner/build/testWorker.js @@ -0,0 +1,150 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.setup = setup; +exports.worker = worker; + +function _exit() { + const data = _interopRequireDefault(require('exit')); + + _exit = function () { + return data; + }; + + return data; +} + +function _jestHasteMap() { + const data = _interopRequireDefault(require('jest-haste-map')); + + _jestHasteMap = function () { + return data; + }; + + return data; +} + +function _jestMessageUtil() { + const data = require('jest-message-util'); + + _jestMessageUtil = function () { + return data; + }; + + return data; +} + +function _jestRuntime() { + const data = _interopRequireDefault(require('jest-runtime')); + + _jestRuntime = function () { + return data; + }; + + return data; +} + +function _jestWorker() { + const data = require('jest-worker'); + + _jestWorker = function () { + return data; + }; + + return data; +} + +var _runTest = _interopRequireDefault(require('./runTest')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * 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. + * + */ +// Make sure uncaught errors are logged before we exit. +process.on('uncaughtException', err => { + console.error(err.stack); + (0, _exit().default)(1); +}); + +const formatError = error => { + if (typeof error === 'string') { + const {message, stack} = (0, _jestMessageUtil().separateMessageFromStack)( + error + ); + return { + message, + stack, + type: 'Error' + }; + } + + return { + code: error.code || undefined, + message: error.message, + stack: error.stack, + type: 'Error' + }; +}; + +const resolvers = new Map(); + +const getResolver = config => { + const resolver = resolvers.get(config.name); + + if (!resolver) { + throw new Error('Cannot find resolver for: ' + config.name); + } + + return resolver; +}; + +function setup(setupData) { + // Module maps that will be needed for the test runs are passed. + for (const { + config, + serializableModuleMap + } of setupData.serializableResolvers) { + const moduleMap = _jestHasteMap() + .default.getStatic(config) + .getModuleMapFromJSON(serializableModuleMap); + + resolvers.set( + config.name, + _jestRuntime().default.createResolver(config, moduleMap) + ); + } +} + +const sendMessageToJest = (eventName, args) => { + (0, _jestWorker().messageParent)([eventName, args]); +}; + +async function worker({config, globalConfig, path, context}) { + try { + return await (0, _runTest.default)( + path, + globalConfig, + config, + getResolver(config), + context && { + ...context, + changedFiles: context.changedFiles && new Set(context.changedFiles), + sourcesRelatedToTestsInChangedFiles: + context.sourcesRelatedToTestsInChangedFiles && + new Set(context.sourcesRelatedToTestsInChangedFiles) + }, + sendMessageToJest + ); + } catch (error) { + throw formatError(error); + } +} |