mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
`babel-jest` is jest's default transformer, and with no babel config it is a
no-op. The api workspace has none — not in api/, not at the repo root, not in
package.json — so nothing there was ever converted. That is invisible until a
CommonJS `require` reaches a dependency that ships ESM:
models/tx.spec.js
-> @hanzochat/api
-> @hanzochat/agents
-> @langchain/mistralai
-> @mistralai/mistralai/esm/index.js "export * from './lib/config.js'"
node throws `SyntaxError: Unexpected token 'export'` at import time, jest counts
one failed suite and ZERO tests, and every suite that touches a model or an
agent goes quiet. 66 of the 80 silent suites died on that one line.
Both halves are load-bearing and were verified separately: with the babel config
but @mistralai/mistralai still excluded by `transformIgnorePatterns`, tx.spec.js
is back to 0 tests; the allow-list alone never worked because there was no
transformer behind it.
MEASURED, `jest --ci` over the api workspace:
suites 57 passed / 122 failed -> 105 passed / 73 failed
tests 1079 run, 717 passed -> 2707 run, 2280 passed
suites reporting zero tests: 80 -> 18
suites that passed before and fail after: 0
suites that ran fewer tests after than before: 0
The remaining 18 are not one lever. Each is a spec whose own `jest.mock` factory
for @hanzochat/data-schemas or @hanzochat/api omits a member the module under
test calls at require time — `createModels` (10), `createMethods`, `isEnabled`,
`violationCache`, and three express routers handed an undefined handler. They
need one fix each and are left failing loudly rather than skipped.
Co-authored-by: Hanzo Dev <[email protected]>
11 lines
523 B
JavaScript
11 lines
523 B
JavaScript
/* babel is used for backend unit testing.
|
|
|
|
The api workspace is CommonJS, so this exists for exactly one reason: a
|
|
dependency reached through `require` that ships ESM. Without a babel config
|
|
`babel-jest` is a no-op, so `transformIgnorePatterns` alone cannot help —
|
|
the ESM stays ESM and node throws `SyntaxError: Unexpected token 'export'`
|
|
at import time, which jest counts as one failed suite and ZERO tests. */
|
|
module.exports = {
|
|
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
|
|
};
|