mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis92.github.io/angular-calendar/
MIT License
2.72k stars 865 forks source link

fix: restore compatibility with jest 28 #1599

Closed dereekb closed 2 years ago

dereekb commented 2 years ago

Fixes the adaptors export. Current export has issues when running in a jest 28 testing environment due to the ESM resolution.

Example error:

...

    Details:

    /home/circleci/code/node_modules/angular-calendar/date-adapters/esm/date-fns/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { __assign } from "tslib";
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module
...

https://app.circleci.com/pipelines/github/dereekb/dbx-components/1530/workflows/fdecd446-eb34-4ba3-8f42-d4917aa8eb56/jobs/4210/parallel-runs/0/steps/0-110

This change allows Jest/CommonJS to import the date-adapters via require(). This change does not impact Angular builds that utilize ESM.

mattlewis92 commented 2 years ago

Released as 0.30.1, please let me know if that works for you! 🙌

dereekb commented 2 years ago

Thank you!