create-jest-runner
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -1,3 +0,10 @@ | ||
import { CallbackTestRunner } from 'jest-runner'; | ||
import type { Config, OnTestFailure, OnTestStart, OnTestSuccess, Test, TestRunnerOptions, TestWatcher } from 'jest-runner'; | ||
import type { CreateRunnerOptions } from './types'; | ||
export default function createRunner<ExtraOptions extends Record<string, unknown>>(runPath: string, { getExtraOptions }?: CreateRunnerOptions<ExtraOptions>): typeof CallbackTestRunner; | ||
export default function createRunner<ExtraOptions extends Record<string, unknown>>(runPath: string, { getExtraOptions }?: CreateRunnerOptions<ExtraOptions>): { | ||
new (globalConfig: Config.GlobalConfig): { | ||
"__#2@#globalConfig": Config.GlobalConfig; | ||
runTests(tests: Array<Test>, watcher: TestWatcher, onStart: OnTestStart, onResult: OnTestSuccess, onFailure: OnTestFailure, options: TestRunnerOptions): Promise<void>; | ||
_createInBandTestRun(tests: Array<Test>, watcher: TestWatcher, onStart: OnTestStart, onResult: OnTestSuccess, onFailure: OnTestFailure, options: TestRunnerOptions): Promise<void>; | ||
_createParallelTestRun(tests: Array<Test>, watcher: TestWatcher, onStart: OnTestStart, onResult: OnTestSuccess, onFailure: OnTestFailure, options: TestRunnerOptions): Promise<void>; | ||
}; | ||
}; |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _jestRunner = require("jest-runner"); | ||
var _jestWorker = require("jest-worker"); | ||
@@ -17,2 +15,16 @@ | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } | ||
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } | ||
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; } | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } | ||
function determineSlowTestResult(test, result) { | ||
@@ -42,3 +54,14 @@ // See: https://github.com/facebook/jest/blob/acd7c83c8365140f4ecf44a456ff7366ffa31fa2/packages/jest-runner/src/runTest.ts#L287 | ||
} = {}) { | ||
return class BaseTestRunner extends _jestRunner.CallbackTestRunner { | ||
var _globalConfig; | ||
return _globalConfig = /*#__PURE__*/new WeakMap(), class BaseTestRunner { | ||
constructor(globalConfig) { | ||
_classPrivateFieldInitSpec(this, _globalConfig, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldSet(this, _globalConfig, globalConfig); | ||
} | ||
runTests(tests, watcher, onStart, onResult, onFailure, options) { | ||
@@ -61,3 +84,3 @@ return options.serial ? this._createInBandTestRun(tests, watcher, onStart, onResult, onFailure, options) : this._createParallelTestRun(tests, watcher, onStart, onResult, onFailure, options); | ||
config: test.context.config, | ||
globalConfig: this._globalConfig, | ||
globalConfig: _classPrivateFieldGet(this, _globalConfig), | ||
testPath: test.path, | ||
@@ -81,3 +104,3 @@ rawModuleMap: watcher.isWatchMode() ? test.context.moduleMap.getRawModuleMap() : null, | ||
exposedMethods: ['default'], | ||
numWorkers: this._globalConfig.maxWorkers, | ||
numWorkers: _classPrivateFieldGet(this, _globalConfig).maxWorkers, | ||
forkOptions: { | ||
@@ -87,3 +110,3 @@ stdio: 'inherit' | ||
}); | ||
const mutex = (0, _throat.default)(this._globalConfig.maxWorkers); | ||
const mutex = (0, _throat.default)(_classPrivateFieldGet(this, _globalConfig).maxWorkers); | ||
@@ -98,3 +121,3 @@ const runTestInWorker = test => mutex(() => { | ||
config: test.context.config, | ||
globalConfig: this._globalConfig, | ||
globalConfig: _classPrivateFieldGet(this, _globalConfig), | ||
testPath: test.path, | ||
@@ -101,0 +124,0 @@ rawModuleMap: watcher.isWatchMode() ? test.context.moduleMap.getRawModuleMap() : null, |
{ | ||
"name": "create-jest-runner", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "types": "build/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25267
528