4ce4204b6c
CI / Lint (push) Failing after 2s
CI / Build (push) Has been skipped
SDK CI / PHP SDK (push) Failing after 1s
Split PHP SDK / PHP SDK tests (push) Failing after 1s
CI / Test (push) Failing after 1s
CI / Dashboard (push) Failing after 0s
SDK CI / JavaScript SDK (push) Failing after 0s
SDK CI / Python SDK (push) Failing after 2s
SDK CI / Java SDK (push) Failing after 1s
Split PHP SDK / Mirror sdk/php -> rmyndharis/openwa-php (push) Has been skipped
CI / Test (PostgreSQL migrations) (push) Failing after 7m47s
CI / Docker Build (push) Has been skipped
18 lines
827 B
JavaScript
18 lines
827 B
JavaScript
/**
|
|
* Packaging smoke test: load the BUILT dist/ through Node's real CJS and ESM
|
|
* loaders. Unit tests run under vitest's bundler-like resolver and cannot catch
|
|
* a dual-format misconfig (CJS parsed as ESM, or extensionless ESM specifiers),
|
|
* so this guards `npm publish` against shipping an unconsumable package.
|
|
* Run after `npm run build`.
|
|
*/
|
|
import { createRequire } from 'node:module';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const cjs = require('../dist/cjs/index.js');
|
|
if (typeof cjs.OpenWAClient !== 'function') throw new Error('CJS: OpenWAClient missing');
|
|
|
|
const esm = await import(new URL('../dist/esm/index.js', import.meta.url).href);
|
|
if (typeof esm.OpenWAClient !== 'function') throw new Error('ESM: OpenWAClient missing');
|
|
|
|
console.log('smoke OK: require() + import() both resolve OpenWAClient');
|