Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support Angular 13 in CJS mode #1122

Merged
merged 1 commit into from
Nov 4, 2021
Merged

feat: support Angular 13 in CJS mode #1122

merged 1 commit into from
Nov 4, 2021

Commits on Nov 4, 2021

  1. feat: support Angular 13 in CJS mode

    BREAKING CHANGE
    * **NodeJs** range version support now is `^12.20.0 || ^14.15.0 || >=16.10.0`
    * Due to the introduction of **ESM package format** for Angular packages, several things are added to the **default preset** to handle `.mjs` files from **Angular ESM packages**:
      + `ng-jest-resolver` is introduced as a custom Jest resolver to resolve `.mjs` files.
      + `transformIgnorePatterns` is added to inform Jest to transform `.mjs` files.
      + `transform` is updated to include `.mjs` extension to transform to `CommonJS` codes.
    
    If one has custom Jest config, please make sure to adjust Jest config as following:
    ```
    // jest.config.js
    module.exports = {
         // other config
         resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
         transformIgnorePatterns: ['node_modules/(?!@angular)'],
         transform: {
            '^.+\\.(ts|js|mjs|html|svg)$': 'jest-preset-angular',
         },
    }
    ```
    Ahn authored and ahnpnl committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    55d6a48 View commit details
    Browse the repository at this point in the history