qerrors
Version:
Intelligent error handling middleware with AI-powered analysis, environment validation, caching, and production-ready logging. Provides OpenAI-based error suggestions, queue management, retry mechanisms, and comprehensive configuration options for Node.js
591 lines (548 loc) • 30.6 kB
Plain Text
~/workspace$ node -r ./setup.js --test
Missing OPENAI_API_KEY in environment variables.
(node:4986) [LRU_CACHE_UNBOUNDED] UnboundedCacheWarning: TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.
(Use `node --trace-warnings ...` to show where the warning was created)
✔ analyzeError handles AxiosError gracefully (2.12817ms)
✔ analyzeError returns null without token (2.916309ms)
✖ analyzeError processes JSON response from API (13.664378ms)
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert.ok(result)
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:83:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: null,
expected: true,
operator: '=='
}
✔ analyzeError handles JSON parse errors (0.413749ms)
✖ analyzeError returns cached advice on repeat call (0.547691ms)
TypeError [Error]: Cannot read properties of null (reading 'advice')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:122:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError reuses error.qerrorsKey when present (0.41609ms)
TypeError [Error]: Cannot read properties of null (reading 'info')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:152:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError retries failed axios calls (0.50077ms)
TypeError [Error]: Cannot read properties of null (reading 'ok')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:176:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError uses postWithRetry helper (0.35033ms)
TypeError [Error]: Cannot read properties of null (reading 'ok')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:196:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError bypasses cache when limit is zero (4.7553ms)
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
false !== true
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:229:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: 'strictEqual'
}
✔ analyzeError does not hash when cache limit is zero (2.929819ms)
stringifyContext is running with string
stringifyContext is returning testFunction
stringifyContext is running with string
stringifyContext is returning testFunction
stringifyContext is running with string
stringifyContext is returning testFunction
stringifyContext is running with string
stringifyContext is returning testController
stringifyContext is running with string
stringifyContext is returning testController
HIGH SEVERITY ERROR in testController: {
error: 'Generic error',
context: {
severity: 'high',
timestamp: '2025-08-10T18:23:51.213Z',
requestId: '26a490d1-47d8-4311-a3f3-a8fe65d5a123'
}
}
stringifyContext is running with string
stringifyContext is returning testOperation
stringifyContext is running with string
stringifyContext is returning testOperation
HIGH SEVERITY ERROR in testOperation: {
error: 'Operation failed',
context: {
severity: 'high',
timestamp: '2025-08-10T18:23:51.218Z',
requestId: 'f1d95633-8fd6-4745-a82d-467123965ead'
}
}
stringifyContext is running with string
stringifyContext is returning testOperation
✔ logErrorWithSeverity logs with severity context (27.190767ms)
✔ handleControllerError sends standardized response (3.872919ms)
✔ handleControllerError defaults error type and uses error message (3.28968ms)
✔ withErrorHandling executes operation and returns result on success (0.86162ms)
✔ withErrorHandling logs error and returns fallback on failure (1.196259ms)
✔ withErrorHandling defaults to medium severity when error has no severity (0.806179ms)
✔ withErrorHandling returns null fallback when no fallback provided (0.81868ms)
✔ advice cleanup interval start and stop (304.03353ms)
✔ purgeExpiredAdvice triggers cache purge (2.392349ms)
✔ queue metrics interval start and stop (2.539429ms)
✔ getAdviceCacheLimit reflects clamped env (2.1369ms)
✖ clearAdviceCache empties cache (506.508594ms)
TypeError [Error]: Cannot read properties of null (reading 'info')
at TestContext.<anonymous> (/home/runner/workspace/test/clearCache.test.js:28:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✔ cache limit above threshold clamps and warns (6.05389ms)
✔ getEnv returns env var when present (2.80613ms)
✔ getEnv falls back to default (0.65028ms)
✔ safeRun returns result (0.63247ms)
✔ safeRun returns fallback on error (0.69601ms)
✔ getInt parses integer env value (0.78651ms)
✔ getInt uses default when env invalid (0.51627ms)
✔ getInt enforces minimum bound (0.50922ms)
stringifyContext is running with object
stringifyContext is returning {"foo":"bar"}
stringifyContext is running with object
stringifyContext is returning <ref *1> { self: [Circular *1] }
Missing OPENAI_API_KEY in environment variables.
✖ qerrors stringifies object context for openai request (67.291331ms)
TypeError [Error]: Cannot read properties of undefined (reading 'messages')
at TestContext.<anonymous> (/home/runner/workspace/test/contextStringify.test.js:48:26)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✔ qerrors handles circular context without throwing (6.237869ms)
✔ sanitizeMessage masks credit card numbers (2.533049ms)
✔ sanitizeMessage masks SSN patterns (0.36127ms)
✔ sanitizeMessage masks CVV codes (0.23299ms)
✔ sanitizeMessage masks passwords (0.18623ms)
✔ sanitizeMessage masks API keys (0.17672ms)
✔ sanitizeMessage masks authentication tokens (0.18499ms)
✔ sanitizeMessage masks email addresses (0.30258ms)
✔ sanitizeMessage masks phone numbers (0.24401ms)
✔ sanitizeMessage handles non-string input (0.38102ms)
✖ sanitizeContext handles simple objects (1.77028ms)
AssertionError [ERR_ASSERTION]: '[CARD-REDACTED]' == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:99:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: '[CARD-REDACTED]',
expected: '[REDACTED]',
operator: '=='
}
✖ sanitizeContext masks sensitive keys (0.44981ms)
AssertionError [ERR_ASSERTION]: 'keyvalue' == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:111:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 'keyvalue',
expected: '[REDACTED]',
operator: '=='
}
✖ sanitizeContext handles nested objects recursively (0.59325ms)
AssertionError [ERR_ASSERTION]: undefined == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:132:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: undefined,
expected: '[REDACTED]',
operator: '=='
}
✔ sanitizeContext handles arrays (0.40944ms)
✔ sanitizeContext handles null and undefined values (0.420731ms)
✔ createEnhancedLogEntry generates complete log structure (0.82418ms)
✔ createEnhancedLogEntry includes memory usage for high severity levels (0.69335ms)
✔ createEnhancedLogEntry sanitizes message and context (0.49167ms)
✔ logInfo function exists and can be called (33.565116ms)
✔ logError function exists and can be called (1.16299ms)
✔ createPerformanceTimer returns a function (0.422269ms)
✔ createPerformanceTimer function can be executed (1.06066ms)
✔ createPerformanceTimer handles failure scenarios (0.87444ms)
✔ LOG_LEVELS contains all expected levels with priorities (0.22607ms)
Missing required environment variables: REQUIRED_VAR
Error: Missing required environment variables: REQUIRED_VAR
at throwIfMissingEnvVars (/home/runner/workspace/lib/envUtils.js:42:28)
at /home/runner/workspace/test/envUtils.test.js:57:24
at getActual (node:assert:498:5)
at Function.throws (node:assert:644:24)
at TestContext.<anonymous> (/home/runner/workspace/test/envUtils.test.js:56:23)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
✔ getMissingEnvVars identifies missing variables (2.03644ms)
✔ getMissingEnvVars returns empty array when all present (0.19649ms)
✔ throwIfMissingEnvVars throws when variables missing (3.26441ms)
✔ throwIfMissingEnvVars returns empty array when all present (0.30856ms)
✔ warnIfMissingEnvVars returns false when variables missing (0.35098ms)
✔ warnIfMissingEnvVars returns true when all present (0.163189ms)
✔ warnIfMissingEnvVars uses custom message (0.196511ms)
✔ ErrorTypes constants are properly defined (1.62166ms)
✔ ErrorSeverity constants are properly defined (0.15891ms)
✔ ERROR_STATUS_MAP maps types to correct HTTP status codes (0.23642ms)
✔ ERROR_SEVERITY_MAP maps types to correct severity levels (0.18413ms)
✔ getRequestId extracts ID from request headers (0.27794ms)
✔ getRequestId generates UUID when no headers available (0.60917ms)
✔ createStandardError builds properly formatted error object (0.4319ms)
✔ createStandardError removes req and res from context (0.205239ms)
✔ sendErrorResponse sends JSON with correct status (0.89767ms)
✔ sendErrorResponse does not send when headers already sent (0.275ms)
✔ createTypedError creates error with proper classification (0.25988ms)
✔ createTypedError uses defaults when optional parameters omitted (0.1944ms)
✔ ErrorFactory.validation creates properly formatted validation error (0.2826ms)
✔ ErrorFactory.authentication creates auth error with default message (0.26934ms)
✔ ErrorFactory.authentication accepts custom message and context (0.18596ms)
✔ ErrorFactory.authorization creates authz error with default message (0.28055ms)
✔ ErrorFactory.notFound creates resource-specific error (0.24179ms)
✔ ErrorFactory.rateLimit creates rate limit error with default message (0.33211ms)
✔ ErrorFactory.network creates network error with service context (0.23889ms)
✔ ErrorFactory.database creates database error with operation context (0.30134ms)
✔ ErrorFactory.system creates system error with component context (0.22573ms)
✔ errorMiddleware handles errors with proper response format (0.33483ms)
✔ errorMiddleware defaults untyped errors to system type (0.27145ms)
✔ errorMiddleware handles headers already sent (0.18938ms)
✔ errorMiddleware handles meta-errors gracefully (0.27946ms)
stringifyContext is running with string
stringifyContext is returning Something went wrong
Missing OPENAI_API_KEY in environment variables.
stringifyContext is running with string
stringifyContext is returning Request failed
stringifyContext is running with string
stringifyContext is returning Test message
stringifyContext is running with string
stringifyContext is returning Test message
✔ handleSimpleError sends basic error response (340.527905ms)
✔ handleSimpleError includes request context when provided (0.98496ms)
✔ handleSimpleError handles meta-errors gracefully (0.99598ms)
✔ handleSimpleError respects headers already sent (0.73924ms)
✔ index exports qerrors and logger (1.81718ms)
✔ warn when limits exceed safe threshold (302.91674ms)
✔ limits below custom threshold do not warn (2.54431ms)
stringifyContext is running with string
stringifyContext is returning spyCtx
✔ qerrors integration logs error and analyzes context (62.246192ms)
✔ logger uses QERRORS_LOG_LEVEL env var (27.701777ms)
✔ logger defaults QERRORS_LOG_LEVEL when unset (9.505579ms)
✔ logger exposes standard logging methods (9.595539ms)
✔ logger uses daily rotate when QERRORS_LOG_MAX_DAYS set (34.360745ms)
✔ file transports active when mkdirSync succeeds (3.4415ms)
✔ logger continues with console transport when mkdirSync fails (2.925729ms)
✔ file logs stay disabled after mkdir failure when env unset (2.468699ms)
✔ logger warns when max days zero with file logs (8.968219ms)
✔ logger defaults to console when mkdir fails and verbose unset (2.59864ms)
✔ logStart logs function start (16.381328ms)
✔ logReturn logs function return (0.53888ms)
✔ axiosInstance honors QERRORS_MAX_FREE_SOCKETS (317.299778ms)
✔ axiosInstance uses default max free sockets when env missing (2.22019ms)
✔ axiosInstance uses default max free sockets with invalid env (2.04603ms)
✔ axiosInstance honors QERRORS_MAX_SOCKETS (316.132808ms)
✔ axiosInstance uses default max sockets when env missing (2.73494ms)
✔ axiosInstance uses default max sockets with invalid env (2.66952ms)
✔ max sockets above threshold clamps and warns (30.405526ms)
✖ analyzeError uses QERRORS_MAX_TOKENS (547.992998ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:36:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError defaults QERRORS_MAX_TOKENS when unset (136.220892ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:56:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✖ analyzeError defaults QERRORS_MAX_TOKENS with invalid env (62.050512ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:76:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
✔ postWithRetry adds jitter to wait time (2.372109ms)
✔ postWithRetry uses defaults with invalid env (0.47424ms)
✔ postWithRetry enforces backoff cap (0.48918ms)
✔ postWithRetry uses Retry-After header for rate limit (0.59296ms)
✔ postWithRetry doubles delay when rate limit header missing (0.74946ms)
stringifyContext is running with string
stringifyContext is returning ctx
Missing OPENAI_API_KEY in environment variables.
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors logs and responds with json then calls next (22.137887ms)
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors sends html when accept header requests it (2.82277ms)
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors escapes html content (2.04783ms)
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors honors error.statusCode in json (2.25672ms)
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors honors error.statusCode in html (1.44034ms)
stringifyContext is running with string
stringifyContext is returning unknown context
✔ qerrors does nothing when headers already sent (2.29682ms)
stringifyContext is running with string
stringifyContext is returning ctx
✔ qerrors handles absence of req res and next (1.52796ms)
✔ qerrors calls next without res (2.39356ms)
✔ qerrors exits if no error provided (1.49889ms)
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
Missing OPENAI_API_KEY in environment variables.
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
Missing OPENAI_API_KEY in environment variables.
✔ scheduleAnalysis rejects when queue exceeds limit (361.741503ms)
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
✔ queue reject count increments when queue exceeds limit (34.860655ms)
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
stringifyContext is running with string
stringifyContext is returning unknown context
✖ getQueueLength reflects queued analyses (20.295138ms)
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 1
at TestContext.<anonymous> (/home/runner/workspace/test/queue.test.js:84:12)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 0,
expected: 1,
operator: 'strictEqual'
}
✔ scheduleAnalysis uses defaults on invalid env (2.012309ms)
Missing OPENAI_API_KEY in environment variables.
stringifyContext is running with string
stringifyContext is returning unknown context
Missing OPENAI_API_KEY in environment variables.
✔ queue never exceeds limit under high concurrency (55.306003ms)
stringifyContext is running with string
stringifyContext is returning unknown context
✔ metrics stop when queue drains then restart on new analysis (66.269002ms)
✔ logger uses QERRORS_SERVICE_NAME env var (18.629938ms)
✔ logger defaults QERRORS_SERVICE_NAME when unset (6.074159ms)
✔ axiosInstance honors QERRORS_TIMEOUT (318.461918ms)
✔ axiosInstance uses default timeout when env missing (2.41768ms)
✔ axiosInstance uses default timeout with invalid env (2.29306ms)
✔ logger adds Console transport when verbose true (20.121667ms)
✔ logger excludes Console transport when verbose false (12.008889ms)
✔ verboseLog uses console when QERRORS_VERBOSE=true (2.084719ms)
✔ verboseLog skips console when QERRORS_VERBOSE=false (0.27122ms)
✔ verboseLog skips console when QERRORS_VERBOSE unset (0.31495ms)
ℹ tests 146
ℹ suites 0
ℹ pass 131
ℹ fail 15
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 3285.31136
✖ failing tests:
test at test/analyzeError.test.js:75:1
✖ analyzeError processes JSON response from API (13.664378ms)
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert.ok(result)
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:83:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: null,
expected: true,
operator: '=='
}
test at test/analyzeError.test.js:113:1
✖ analyzeError returns cached advice on repeat call (0.547691ms)
TypeError [Error]: Cannot read properties of null (reading 'advice')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:122:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/analyzeError.test.js:139:1
✖ analyzeError reuses error.qerrorsKey when present (0.41609ms)
TypeError [Error]: Cannot read properties of null (reading 'info')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:152:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/analyzeError.test.js:163:1
✖ analyzeError retries failed axios calls (0.50077ms)
TypeError [Error]: Cannot read properties of null (reading 'ok')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:176:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/analyzeError.test.js:185:1
✖ analyzeError uses postWithRetry helper (0.35033ms)
TypeError [Error]: Cannot read properties of null (reading 'ok')
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:196:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/analyzeError.test.js:210:1
✖ analyzeError bypasses cache when limit is zero (4.7553ms)
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
false !== true
at TestContext.<anonymous> (/home/runner/workspace/test/analyzeError.test.js:229:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: 'strictEqual'
}
test at test/clearCache.test.js:16:1
✖ clearAdviceCache empties cache (506.508594ms)
TypeError [Error]: Cannot read properties of null (reading 'info')
at TestContext.<anonymous> (/home/runner/workspace/test/clearCache.test.js:28:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/contextStringify.test.js:34:1
✖ qerrors stringifies object context for openai request (67.291331ms)
TypeError [Error]: Cannot read properties of undefined (reading 'messages')
at TestContext.<anonymous> (/home/runner/workspace/test/contextStringify.test.js:48:26)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/enhancedLogging.test.js:90:1
✖ sanitizeContext handles simple objects (1.77028ms)
AssertionError [ERR_ASSERTION]: '[CARD-REDACTED]' == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:99:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: '[CARD-REDACTED]',
expected: '[REDACTED]',
operator: '=='
}
test at test/enhancedLogging.test.js:102:1
✖ sanitizeContext masks sensitive keys (0.44981ms)
AssertionError [ERR_ASSERTION]: 'keyvalue' == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:111:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 'keyvalue',
expected: '[REDACTED]',
operator: '=='
}
test at test/enhancedLogging.test.js:116:1
✖ sanitizeContext handles nested objects recursively (0.59325ms)
AssertionError [ERR_ASSERTION]: undefined == '[REDACTED]'
at TestContext.<anonymous> (/home/runner/workspace/test/enhancedLogging.test.js:132:12)
at Test.runInAsyncScope (node:async_hooks:206:9)
at Test.run (node:internal/test_runner/test:796:25)
at Test.processPendingSubtests (node:internal/test_runner/test:526:18)
at Test.postRun (node:internal/test_runner/test:889:19)
at Test.run (node:internal/test_runner/test:835:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: undefined,
expected: '[REDACTED]',
operator: '=='
}
test at test/maxTokens.test.js:19:1
✖ analyzeError uses QERRORS_MAX_TOKENS (547.992998ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:36:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/maxTokens.test.js:39:1
✖ analyzeError defaults QERRORS_MAX_TOKENS when unset (136.220892ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:56:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/maxTokens.test.js:59:1
✖ analyzeError defaults QERRORS_MAX_TOKENS with invalid env (62.050512ms)
TypeError [Error]: Cannot read properties of undefined (reading 'max_tokens')
at TestContext.<anonymous> (/home/runner/workspace/test/maxTokens.test.js:76:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7)
test at test/queue.test.js:66:1
✖ getQueueLength reflects queued analyses (20.295138ms)
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 1
at TestContext.<anonymous> (/home/runner/workspace/test/queue.test.js:84:12)
at async Test.run (node:internal/test_runner/test:797:9)
at async Test.processPendingSubtests (node:internal/test_runner/test:526:7) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 0,
expected: 1,
operator: 'strictEqual'
}