SyntaxError: Unexpected token 'export' when running mocha test

309 Views Asked by At

Our team is getting an export syntax error only when running the mocha tests after including a particular library (Bryntum Scheduler in this case). We are able to reproduce the issue in this sample project: https://github.com/eduardofavarato/bryntum-scheduler-mocha-ts-sample

Error in question:

/frontend/node_modules/@bryntum/scheduler-react/lib/index.js:1
export * from './BryntumFullscreenButton';
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)

Any ideas why? I think it could be related to commonjs vs esmodule discrepancy but not sure. I also shared the problem with the Bryntum team but haven't heard back yet on a resolution.

0

There are 0 best solutions below