Summary
After upgrading @databricks/sql from 1.17.x to 2.0.0, our Jest-based test suite started failing during module load.
The failure happens when @databricks/sql is required from a CommonJS environment. The import chain reaches thrift/node_modules/uuid/dist-node/index.js, which is ESM, and Jest then throws a syntax error.
This did not happen with @databricks/sql@1.17.x.
Error
.../node_modules/thrift/node_modules/uuid/dist-node/index.js:1
export { default as MAX } from './max.js';
^^^^^^
SyntaxError: Unexpected token 'export'
Relevant stack excerpt:
at Object. (node_modules/@databricks/sql/lib/index.ts:4:1)
at Object.require (mocks/@databricks/sql.js:7:25)
Expected behavior
@databricks/sql should be loadable in CommonJS/Jest environments without requiring consumers to add custom ESM transforms for transitive dependencies.
Actual behavior
Loading @databricks/sql@2.0.0 causes Jest to parse an ESM file from a transitive dependency (uuid under thrift) and fail before tests execute.
Notes
This appears to be related to packaging/module compatibility in the dependency chain:
@databricks/sql -> thrift -> uuid/dist-node/index.js (ESM)
Summary
After upgrading
@databricks/sqlfrom1.17.xto2.0.0, our Jest-based test suite started failing during module load.The failure happens when
@databricks/sqlis required from a CommonJS environment. The import chain reachesthrift/node_modules/uuid/dist-node/index.js, which is ESM, and Jest then throws a syntax error.This did not happen with
@databricks/sql@1.17.x.Error
Relevant stack excerpt:
at Object. (node_modules/@databricks/sql/lib/index.ts:4:1)
at Object.require (mocks/@databricks/sql.js:7:25)
Expected behavior
@databricks/sql should be loadable in CommonJS/Jest environments without requiring consumers to add custom ESM transforms for transitive dependencies.
Actual behavior
Loading @databricks/sql@2.0.0 causes Jest to parse an ESM file from a transitive dependency (uuid under thrift) and fail before tests execute.
Notes
This appears to be related to packaging/module compatibility in the dependency chain:
@databricks/sql -> thrift -> uuid/dist-node/index.js (ESM)