test: Add mock for kontroll module

- Add CommonJS mock implementation of kontroll's countdown function
- Add kontroll to moduleNameMapper in Jest config
- Resolves 'Cannot find module kontroll' test errors
This commit is contained in:
Smartsheet-JB-Brown 2025-05-23 15:52:01 -07:00 committed by hannesrudolph
parent 34457ee0f3
commit 87236c7ea0
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,8 @@
// Mock implementation of kontroll's countdown function
module.exports = {
countdown: (delay, callback, options = {}) => {
// Simple mock that just calls the callback immediately
setTimeout(callback, 0)
return () => {} // Return a no-op cleanup function
},
}

View file

@ -37,9 +37,10 @@ export default {
"^default-shell$": "<rootDir>/__mocks__/default-shell.js",
"^os-name$": "<rootDir>/__mocks__/os-name.js",
"^strip-bom$": "<rootDir>/__mocks__/strip-bom.js",
"^kontroll$": "<rootDir>/__mocks__/kontroll.js",
},
transformIgnorePatterns: [
"node_modules/(?!(@modelcontextprotocol|delay|p-wait-for|serialize-error|strip-ansi|default-shell|os-name|strip-bom)/)",
"node_modules/(?!(@modelcontextprotocol|delay|p-wait-for|serialize-error|strip-ansi|default-shell|os-name|strip-bom|kontroll)/)",
],
roots: ["<rootDir>"],
modulePathIgnorePatterns: ["dist", "out"],