Skip to content

Commit ee87056

Browse files
authored
fix: replace throat with p-limit (#147)
1 parent 1252b9a commit ee87056

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

lib/createJestRunner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
TestWatcher,
1111
} from 'jest-runner';
1212
import { Worker, JestWorkerFarm } from 'jest-worker';
13-
import throat from 'throat';
13+
import pLimit from 'p-limit';
1414
import type { CreateRunnerOptions, RunTestOptions } from './types';
1515

1616
function determineSlowTestResult(test: Test, result: TestResult): TestResult {
@@ -76,7 +76,7 @@ export default function createRunner<
7676
onFailure: OnTestFailure,
7777
options: TestRunnerOptions,
7878
): Promise<void> {
79-
const mutex = throat(1);
79+
const mutex = pLimit(1);
8080
return tests.reduce(
8181
(promise, test) =>
8282
mutex(() =>
@@ -131,7 +131,7 @@ export default function createRunner<
131131
default: (runTestOptions: RunTestOptions) => TestResult;
132132
}>;
133133

134-
const mutex = throat(this.#globalConfig.maxWorkers);
134+
const mutex = pLimit(this.#globalConfig.maxWorkers);
135135

136136
const runTestInWorker = (test: Test) =>
137137
mutex(() => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dependencies": {
4141
"chalk": "^4.1.0",
4242
"jest-worker": "^29.0.0",
43-
"throat": "^6.0.1"
43+
"p-limit": "^3.1.0"
4444
},
4545
"devDependencies": {
4646
"@babel/cli": "^7.0.0",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"isolatedModules": true,
1212
"importsNotUsedAsValues": "error",
1313

14-
"esModuleInterop": false,
14+
"esModuleInterop": true,
1515
"skipLibCheck": false,
1616

1717
/* Additional Checks */

yarn.lock

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,9 +2706,9 @@ __metadata:
27062706
jest: ^29.0.0
27072707
jest-runner: ^29.0.0
27082708
jest-worker: ^29.0.0
2709+
p-limit: ^3.1.0
27092710
prettier: ^2.0.5
27102711
strip-ansi: ^6.0.0
2711-
throat: ^6.0.1
27122712
typescript: ^4.3.5
27132713
peerDependencies:
27142714
"@jest/test-result": ^28.0.0 || ^29.0.0
@@ -5833,13 +5833,6 @@ __metadata:
58335833
languageName: node
58345834
linkType: hard
58355835

5836-
"throat@npm:^6.0.1":
5837-
version: 6.0.1
5838-
resolution: "throat@npm:6.0.1"
5839-
checksum: 782d4171ee4e3cf947483ed2ff1af3e17cc4354c693b9d339284f61f99fbc401d171e0b0d2db3295bb7d447630333e9319c174ebd7ef315c6fb791db9675369c
5840-
languageName: node
5841-
linkType: hard
5842-
58435836
"tmpl@npm:1.0.5":
58445837
version: 1.0.5
58455838
resolution: "tmpl@npm:1.0.5"

0 commit comments

Comments
 (0)