Skip to content

Commit 3bccf74

Browse files
committed
feat: add mock implementation for p-limit and update Jest config
1 parent c1b33a6 commit 3bccf74

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/__mocks__/p-limit.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Mock implementation of p-limit for Jest tests
2+
// p-limit is a utility for limiting the number of concurrent promises
3+
4+
const pLimit = (concurrency) => {
5+
// Return a function that just executes the passed function immediately
6+
// In tests, we don't need actual concurrency limiting
7+
return (fn) => {
8+
if (typeof fn === "function") {
9+
return fn()
10+
}
11+
return fn
12+
}
13+
}
14+
15+
// Set default export
16+
pLimit.default = pLimit
17+
18+
module.exports = pLimit

src/jest.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default {
3232
"@modelcontextprotocol/sdk/(.*)": "<rootDir>/__mocks__/@modelcontextprotocol/sdk/$1",
3333
"^delay$": "<rootDir>/__mocks__/delay.js",
3434
"^p-wait-for$": "<rootDir>/__mocks__/p-wait-for.js",
35+
"^p-limit$": "<rootDir>/__mocks__/p-limit.js",
3536
"^serialize-error$": "<rootDir>/__mocks__/serialize-error.js",
3637
"^strip-ansi$": "<rootDir>/__mocks__/strip-ansi.js",
3738
"^default-shell$": "<rootDir>/__mocks__/default-shell.js",

0 commit comments

Comments
 (0)