fix: hanging tests
This commit is contained in:
parent
ce25ca3e1a
commit
4de3c90eec
4 changed files with 21 additions and 0 deletions
|
|
@ -15,6 +15,8 @@ export default {
|
|||
"<rootDir>/node_modules/ink-testing-library/build/index.js",
|
||||
"^./SyntaxHighlighter\\.js$":
|
||||
"<rootDir>/src/ui/__mocks__/SyntaxHighlighter.ts",
|
||||
"^./FreeTrialStatus\\.js$":
|
||||
"<rootDir>/src/ui/__mocks__/FreeTrialStatus.tsx",
|
||||
},
|
||||
extensionsToTreatAsEsm: [".ts", ".tsx"],
|
||||
preset: "ts-jest/presets/default-esm",
|
||||
|
|
@ -23,6 +25,7 @@ export default {
|
|||
testPathIgnorePatterns: ["<rootDir>/dist/"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/dist/"],
|
||||
transformIgnorePatterns: ["node_modules/(?!(highlight.js|lowlight)/)"],
|
||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
||||
globals: {
|
||||
__dirname: path.dirname(fileURLToPath(import.meta.url)),
|
||||
__filename: path.resolve(fileURLToPath(import.meta.url)),
|
||||
|
|
|
|||
2
jest.setup.ts
Normal file
2
jest.setup.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// Disable telemetry for tests
|
||||
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
|
||||
|
|
@ -51,6 +51,11 @@ const FreeTrialStatus: React.FC<FreeTrialStatusProps> = ({
|
|||
// Initial fetch
|
||||
fetchStatus();
|
||||
|
||||
// Don't poll in test environment
|
||||
if (process.env.NODE_ENV === "test") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Poll every 5 seconds
|
||||
const interval = setInterval(fetchStatus, 5000);
|
||||
|
||||
|
|
|
|||
11
src/ui/__mocks__/FreeTrialStatus.tsx
Normal file
11
src/ui/__mocks__/FreeTrialStatus.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import React from "react";
|
||||
|
||||
// Mock FreeTrialStatus component that doesn't create any timers
|
||||
const FreeTrialStatus: React.FC<any> = () => {
|
||||
return null;
|
||||
};
|
||||
|
||||
export default FreeTrialStatus;
|
||||
export function isModelUsingFreeTrial(): boolean {
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue