Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-jest-runner

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-jest-runner - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

72

build/createJestRunner.js

@@ -11,2 +11,3 @@ 'use strict';

var throat = require('throat');
var Worker = require('jest-worker').default;

@@ -37,10 +38,47 @@

// eslint-disable-next-line
_createClass(BaseTestRunner, [{
key: 'runTests',
value: function runTests(tests, watcher, onStart, onResult, onFailure, options) {
return options.serial ? this._createInBandTestRun(tests, watcher, onStart, onResult, onFailure, options) : this._createParallelTestRun(tests, watcher, onStart, onResult, onFailure, options);
}
}, {
key: '_createInBandTestRun',
value: function _createInBandTestRun(tests, watcher, onStart, onResult, onFailure, options) {
var _this2 = this;
return tests.reduce(function (promise, test) {
return promise.then(function () {
if (watcher.isInterrupted()) {
throw new CancelRun();
}
return onStart(test).then(function () {
// eslint-disable-next-line import/no-dynamic-require, global-require
var runner = require(runPath);
var baseOptions = {
config: test.context.config,
globalConfig: _this2._globalConfig,
testPath: test.path,
rawModuleMap: watcher.isWatchMode() ? test.context.moduleMap.getRawModuleMap() : null,
options
};
if (typeof runner.default === 'function') {
return runner.default(baseOptions);
}
return runner(baseOptions);
});
}).then(function (result) {
return onResult(test, result);
}).catch(function (err) {
return onFailure(test, err);
});
}, Promise.resolve());
}
}, {
key: '_createParallelTestRun',
value: function _createParallelTestRun(tests, watcher, onStart, onResult, onFailure, options) {
var _this3 = this;
var worker = new Worker(runPath, {

@@ -52,17 +90,21 @@ exposedMethods: ['default'],

var mutex = throat(this._globalConfig.maxWorkers);
var runTestInWorker = function runTestInWorker(test) {
if (watcher.isInterrupted()) {
throw new CancelRun();
}
return mutex(function () {
if (watcher.isInterrupted()) {
throw new CancelRun();
}
return onStart(test).then(function () {
var baseOptions = {
config: test.context.config,
globalConfig: _this2._globalConfig,
testPath: test.path,
rawModuleMap: watcher.isWatchMode() ? test.context.moduleMap.getRawModuleMap() : null,
options
};
return onStart(test).then(function () {
var baseOptions = {
config: test.context.config,
globalConfig: _this3._globalConfig,
testPath: test.path,
rawModuleMap: watcher.isWatchMode() ? test.context.moduleMap.getRawModuleMap() : null,
options
};
return worker.default(baseOptions);
return worker.default(baseOptions);
});
});

@@ -69,0 +111,0 @@ };

@@ -1,8 +0,23 @@

### O.1.1
## master
Bug fixes
- TTY support for jest-worker
## 0.3.0
### 0.1.0
### Fixes
* Mutex the workers, to behave more like native jest test runs ([#5](https://github.com/rogeliog/create-jest-runner/pull/5))
- Initial Release
### Features
* Support serial execution ([#6](https://github.com/rogeliog/create-jest-runner/pull/6))
## O.2.0
### Features
* Add skip functionality
## O.1.1
### Fixes
* TTY support for jest-worker
## 0.1.0
* Initial Release
{
"name": "create-jest-runner",
"version": "0.2.0",
"version": "0.3.0",
"main": "build/index.js",

@@ -5,0 +5,0 @@ "author": "Rogelio Guzman <rogelioguzmanh@gmail.com>",

@@ -45,3 +45,3 @@ # create-jest-runner

You can return one of the following values:
- `testResult`: Needs to be an object of type https://github.com/facebook/jest/blob/master/types/TestResult.js#L131-L157
- `testResult`: Needs to be an object of type https://github.com/facebook/jest/blob/master/types/TestResult.js#L137-L165
- `Promise<testResult|Error>`: needs to be of above type.

@@ -48,0 +48,0 @@ - `Error`: good for reporting system error, not failed tests.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc