From 60d3e85f1dda1bba63eaabc61cd410a0b7ede5f1 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Thu, 6 Aug 2026 15:04:16 -0600 Subject: [PATCH] TSM-02: add CJS/ESM export compatibility test --- test/services/module_exports_compat.test.js | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/services/module_exports_compat.test.js diff --git a/test/services/module_exports_compat.test.js b/test/services/module_exports_compat.test.js new file mode 100644 index 00000000..8173c3c9 --- /dev/null +++ b/test/services/module_exports_compat.test.js @@ -0,0 +1,25 @@ +import { expect } from 'chai'; +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); + +describe('Package export compatibility', function () { + it('supports CommonJS require', function () { + const EasyPostClient = require('../..'); + + expect(EasyPostClient).to.be.a('function'); + + const client = new EasyPostClient('apiKey'); + expect(client).to.be.an('object'); + }); + + it('supports ESM import default', async function () { + const module = await import('../..'); + const EasyPostClient = module.default; + + expect(EasyPostClient).to.be.a('function'); + + const client = new EasyPostClient('apiKey'); + expect(client).to.be.an('object'); + }); +});