Skip to content

Latest commit

 

History

History
969 lines (457 loc) · 43.4 KB

CHANGELOG.md

File metadata and controls

969 lines (457 loc) · 43.4 KB

11.1.0 (2022-01-20)

Bug Fixes

DEPRECATIONS

  • ngcc-jest-processor is deprecated in favor of globalSetup file (#1275) (75e7368)

11.0.1 (2021-11-22)

Bug Fixes

11.0.0 (2021-11-18)

Bug Fixes

  • presets: use ts-jest types for preset types (#1172) (81854f6)
  • presets: add mjs to the list of moduleFileExtensions (#1155) (3c992a1), closes #1147

Features

Code Refactoring

  • presets: improve transformIgnorePatterns value (#1162) (99a4b1b1)

Performance Improvements

BREAKING CHANGES

  • js files from node_modules are now compiled with esbuild to improve performance.
  • 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. Please check our migration documentation at https://thymikee.github.io/jest-preset-angular/docs/next/guides/angular-13+

Special Thanks

Alan Agius, Pete Bacon Darwin from Angular team

11.0.0-rc.4 (2021-11-15)

Performance Improvements

  • process js files in node_modules with esbuild (#1169) (1de3bf0)

Code Refactoring

  • presets: improve transformIgnorePatterns value (#1162) (99a4b1b1)

BREAKING CHANGES

  • js files from node_modules are now compiled with esbuild to improve performance.

11.0.0-rc.3 (2021-11-09)

Bug Fixes

  • presets: add mjs to the list of moduleFileExtensions (#1155) (3c992a1), closes #1147
  • bring back checks on undefined/null for no-ng-attributes (#1154) (1e7dbf8)
  • serializers: revert partially changes in ng-snapshot (#1150) (44b3b77), closes #1148

11.0.0-rc.2 (2021-11-08)

Performance Improvements

11.0.0-rc.1 (2021-11-04)

Bug Fixes

11.0.0-rc.0 (2021-11-04)

Features

BREAKING CHANGES

Special Thanks

Alan Agius, Pete Bacon Darwin from Angular team

10.1.0 (2021-10-26)

Bug Fixes

  • config: set tsconfig target to ES2015 when target > ES2016 (#1118) (64229a8), closes #1058

Code Refactoring

  • transformers use Angular downlevel-ctor transformer (#1099) (3c26aba)
  • transformers remove workaround for ts < 4.0 in replace-resource transformer (#1100) (ce68298)
  • transformers migrate html-comment to new Jest serializer (#1114) (3005330)

10.0.1 (2021-09-27)

Bug Fixes

  • utils: allow skipping ngcc-jest-processor via some Jest args (#1013) (7d3a712)

10.0.0 (2021-09-16)

Build

BREAKING CHANGES

Angular 9 is no longer supported, see https://angular.io/guide/releases#support-policy-and-schedule The minimum support Angular version now is 10

9.0.7 (2021-08-20)

Bug Fixes

  • utils: support Yarn workspace for ngcc-jest-processor (#991) (4735f90), closes #990

9.0.6 (2021-08-17)

Bug Fixes

  • config: set allowJs: true internally always (#976) (9900c8b), closes #974
  • utils: throw error when cannot find @angular/core for ngcc-jest-preprocessor util (#981) (c35d3f2)

9.0.5 (2021-07-22)

Features

  • remove more trailing whitespaces for component fixture snapshot (#961) (e51cf6f), closes #287

Code Refactoring

  • remove webpack and @angular-devkit/build-angular from peer dependencies and optional dependencies (#973) (ce7fc60)

9.0.4 (2021-06-15)

Bug Fixes

  • widen range for optional webpack dependency (#955) (b3e8047)

9.0.3 (2021-06-08)

Bug Fixes

  • add missing @angular/platform-browser-dynamic to peer dep (c1729e4)

9.0.2 (2021-06-06)

Bug Fixes

9.0.1 (2021-05-28)

Bug Fixes

9.0.0 (2021-05-27)

Bug Fixes

Features

Performance Improvements

  • compiler: reuse cacheFS from jest to reduce file system reading (#679) (f5d9d4b)
  • config: set skipLibCheck: true if not defined in tsconfig (#678) (0df3ce1)

BREAKING CHANGES

  • Drop support for Angular < 9.0, see https://angular.io/guide/releases#support-policy-and-schedule.
  • Drop support for Node.js version 10 since it becomes EOL on 2021-04-30. Required Node version now is >=12.13.0.
  • Require Jest 27.
  • Users who are using import 'jest-preset-angular' should change to import 'jest-preset-angular/setup-jest'
  • transformers: The AST transformers InlineFilesTransformer and StripStylesTransformer are REMOVED and default jest-preset-angular uses AST transformers from @angular/compiler-cli and @ngtools/webpack. One should remove the old transformers from the jest config.
  • compiler: jest-preset-angular now switches to default to use its own transformer which wraps around ts-jest to transform codes.

Users who are currently doing in jest config

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'ts-jest',
    },
}

should change to

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'jest-preset-angular',
    },
}
  • serializers:: snapshot serializer paths have been changed:
    • 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js' is changed to 'jest-preset-angular/build/serializers/no-ng-attributes.
    • 'jest-preset-angular/build/AngularSnapshotSerializer.js' is changed to 'jest-preset-angular/build/serializers/ng-snapshot.
    • 'jest-preset-angular/build/HTMLCommentSerializer.js' is changed to 'jest-preset-angular/build/serializers/html-comment.
  • When generating a new project from Angular CLI, by default the tsconfig.json doesn't contain any path mappings hence removing moduleNameMapper from preset will make sure that the preset works in pair with tsconfig.json. Ones who are relying on the value of moduleNameMapper from the preset should create their own moduleNameMapper config manually or via ts-jest util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping.

If you wish to reuse the old configuration of moduleNameMapper, you can put this into your Jest config

moduleNameMapper: {
  '^src/(.*)$': '<rootDir>/src/$1',
  '^app/(.*)$': '<rootDir>/src/app/$1',
  '^assets/(.*)$': '<rootDir>/src/assets/$1',
  '^environments/(.*)$': '<rootDir>/src/environments/$1',
}
  • By default, if skipLibCheck is not defined in tsconfig, jest-preset-angular will set it to true. If one wants to have it as false, one can set explicitly in tsconfig.
  • compiler: jest-preset-angular now switches to default to use its own transformer which wraps around ts-jest to transform codes.

Users who are currently doing in jest config

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'ts-jest',
    },
}

should change to

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'jest-preset-angular',
    },
}

9.0.0-next.14 (2021-05-05)

Bug Fixes

BREAKING CHANGES

When generating a new project from Angular CLI, by default the tsconfig.json doesn't contain any path mappings hence removing moduleNameMapper from preset will make sure that the preset works in pair with tsconfig.json.

Ones who are relying on the value of moduleNameMapper from the preset should create their own moduleNameMapper config manually or via ts-jest util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping

9.0.0-next.13 (2021-04-18)

BREAKING CHANGES

  • Drop support for Node.js version 10 since it becomes EOL on 2021-04-30. To support Angular 12, Node.js 12.13+ or 14.15+ is required.

9.0.0-next.12 (2021-03-31)

Bug Fixes

9.0.0-next.11 (2021-03-21)

Features

  • config: load zone ESM when running jest in ESM mode (#892) (e03ec19), closes #751

BREAKING CHANGES

8.4.0 (2021-03-04)

Features

DEPRECATIONS

  • Import serializer via 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js' is deprecated in favor of 'jest-preset-angular/build/serializers/no-ng-attributes'
  • Import serializer via 'jest-preset-angular/build/AngularSnapshotSerializer.js' is deprecated in favor of 'jest-preset-angular/build/serializers/ng-snapshot'
  • Import serializer via 'jest-preset-angular/build/HTMLCommentSerializer.js' is deprecated in favor of 'jest-preset-angular/build/serializers/html-comment'
  • Import setup file via import 'jest-preset-angular' is deprecated in favor of import 'jest-preset-angular/setup-jest'

9.0.0-next.8 (2021-02-12)

Features

  • compiler: use constructor downlevel ctor transformer for isolatedModules: true (#792) (00c71ce)
  • presets: add type definition for presets entry point (#801) (e4ff0c0)

9.0.0-next.6 (2021-01-14)

Features

  • compiler: support ESM for isolatedModules: false (#721) (a2166f8)
  • compiler: use replace-resources for isolatedModules: true (#717) (76c25d2)
  • presets: add ESM preset (#723) (b0073b0)

9.0.0-next.5 (2021-01-06)

Features

  • compiler: use replace-resources transformer from Angular (#708) (1b20c19)
  • utils: add es2015 to ngcc script's properties (#701) (a13070b)

BREAKING CHANGES

  • isolatedModules: true will use inline-files and strip-styles transformers as default transformers.
  • isolatedModules: false will use replace-resources transformer from @ngtools/webpack (besides the existing downlevel-ctor transformer). This will make jest-preset-angular become closer to what Angular CLI does with Karma + Jasmine.
  • For users who migrate from v8.3.2 to 9.0.0, any references to 'jest-preset-angular/build/InlineFilesTransformer' and 'jest-preset-angular/build/StripStylesTransformer' should be removed from jest config.
  • For users who migrate from 9.0.0-next.4, any references to jest-preset-angular/build/transformers/inline-files and jest-preset-angular/build/transformers/inline-files should be removed from jest config.

9.0.0-next.4 (2020-12-18)

Performance Improvements

  • compiler: reuse cacheFS from jest to reduce file system reading (#679) (f5d9d4b)
  • config: set skipLibCheck: true if not defined in tsconfig (#678) (0df3ce1)

BREAKING CHANGES

  • By default, if skipLibCheck is not defined in tsconfig, jest-preset-angular will set it to true. If one wants to have it as false, one can set explicitly in tsconfig.
  • Require Jest 27

9.0.0-next.1 (2020-10-29)

BREAKING CHANGES

  • compiler: jest-preset-angular now switches to default to use its own transformer which wraps around ts-jest to transform codes.

Users who are currently doing in jest config

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'ts-jest',
    },
}

should change to

// jest.config.js
module.exports = {
    // [...]
    transform: {
      '^.+\\.(ts|js|html)$': 'jest-preset-angular',
    },
}

8.3.2 (2020-10-23)

Chores

  • config: switch to tsconfig for jest-preset.js

9.0.0-next.0 (2020-10-18)

Chore

BREAKING CHANGES

We are working on Ivy compatibility for this preset. This requires introducing a different Jest transformer than the default one from ts-jest. To get updates on this work, please subscribe to #409

  • Users who are using import 'jest-preset-angular' should change to import 'jest-preset-angular/setup-jest'
  • Drop support for Angular < 8.0, see https://angular.io/guide/releases#support-policy-and-schedule
  • transformers: The AST transformers InlineFilesTransformer and StripStylesTransformer are REMOVED and default jest-preset-angular uses AST transformers from @angular/compiler-cli. One should remove the old transformers from the jest config.
  • serializers: One is using all jest-preset-angular snapshot serializers should change jest config to have:
// jest.config.js
const jestPresetAngularSerializers = require('jest-preset-angular/build/serializers')

module.exports = {
     // [...]
     snapshotSerializers: jestPresetAngularSerializers,
}

One is using one of jest-preset-angular snapshot serializers should change jest config to have:

// jest.config.js
module.exports = {
     // [...]
     snapshotSerializers: [
          'jest-preset-angular/build/serializers/html-comment'
     ]
}

or

// package.json
{
      // [...]
     "jest": {
           snapshotSerializers: [
                "jest-preset-angular/build/serializers/html-comment"
           ]
      }
}

8.3.1 (2020-08-23)

Bug Fixes

  • Correct wrong published content in v8.3.0

8.3.0 (2020-08-23)

Features

Bug Fixes

  • change astTransformers in preset config (#443) (276784), closes #439

8.2.1 (2020-06-19)

Features

8.2.0 (2020-05-07)

Features

8.1.3 (2020-03-31)

Features

  • make AngularSnapshotSerializer compatible with Ivy (#366) (c648786)

8.1.2 (2020-03-15)

Bug Fixes

  • simplify zone patch test method impl (#361) (4cc8708)

8.1.1 (2020-03-12)

Bug Fixes

  • zone.js patch jest should handle done correctly (#357) (34287f5)

8.1.0 (2020-03-10)

Bug Fixes

8.0.0 (2019-10-21)

Features

  • breaking: Refine ast-transformer behavior: only transform styles-assignments inside @Component (#261) and TypeScript v2.9 createStringLiteral is polyfilled if an older version is used (#272).
  • breaking: Restructure project with src and build folder (#307).
  • breaking: Support tsconfig.spec.json in root folder by default (#309).
  • breaking: Enable AngularNoAngularNoNgAttributesSnapshotSerializer (created in #97) by default (#318).
  • Remove core-js dependency by using internal, minimal reflect-metadata (#315).

Chores

  • Update jsdom to current version 15 (#318).

BREAKING CHANGES

  • If the astTransformers are referenced in a custom jest config, [ 'jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer'] have to be set instead.
  • Serializers, transformers and setupJest have to be referenced from the jest-preset-angular/build/-folder in a custom config. Existing references have to be aligned.
  • If your tsconfig.spec.json is located in src, move it to your root folder and adjust the referenced files and paths inside, or align your jest configuration as discussed in the README.md.
  • In an Angular 8 project or higher, core-js should no longer be a dependency declared in package.json, unless it's imported manually in the code.

7.1.0 (2019-05-20)

Features

  • component serializer without ng-* attributes (#97) (1079528)
  • support core-js >=2.0.0 < 4.0.0 (#246) (239a647)

Chores

  • Fixed a CI cache issue in the example app, which would not always use the current version of the preset in the test runs.

7.0.0 (2019-03-08)

Bug Fixes

  • moved @types/jest to devDependencies (#227) (d65fdc9)

Features

Chores

  • Remove template literal character escaping, reverts #34
  • Migrate CI config to CircleCI v2 (#212)
  • docs: do not use .babelrc file but rather babel.config.js (#231)
  • docs: add astTransformers in configuration example (#218)

BREAKING CHANGES

  • If global and transform are not set in your configuration in jest.config.json, jest.config.js or package.json, you are done.
  • If the global value of the configuration was overridden, adjust
    • The option "__TRANSFORM_HTML__": true is not required anymore. Instead the "stringifyContentPathRegex": "\\.html$" should be used inside the ts-jest-configuration.
    • Change the assignment identifier from tsConfigFile to tsConfig.
    • Add the astTransformers: [require.resolve('jest-preset-angular/InlineHtmlStripStylesTransformer')] so Jest can work with templateUrl-assignments in Component decorators.
  • If transform was overridden, remove the entry pointing at preprocessor.js and add "^.+\\.(ts|js|html)$": "ts-jest" to the transform-object.
  • If in doubt, check the configuration example in jest-preset.json.

6.0.1 (2018-09-19)

Bug Fixes

  • restrict version of ts-jest to ~23.1.3 (#196) (62673cf)
  • support backtick quoted templateUrl (#182) (145c8ea)

Chores

  • Add HeroesComponent example with mocked service provider (#110)
  • docs: Adjust troubleshooting to support configuration with Angular 6 (#187)

6.0.0 (2018-08-03)

Features

  • Compatibility with jest v23 (#173)

5.2.3 (2018-06-26)

Bug Fixes

  • transformer breaking on spaces before colon (#165) (bd5b569), closes #164

5.2.2 (2018-04-27)

Bug Fixes

  • update STYLE_URLS_REGEX to not break on multiple new lines (#139)

Chores

  • specify angular modules as peerDependencies (#141)
  • docs: add more troubleshooting docs (#129)

5.2.1 (2018-03-08)

Bug Fixes

  • update ts-jest to 22.4.1 – urgent fix for enableTsDiagnostics (#130)

Chores

  • Change testRegex to testMatch (#131)

5.2.0 (2018-02-26)

Chores

  • Upgrade ts-jest and remove mapCoverage from jest-preset (requires jest@^22.4.0 as a dependency now) (#127)

5.1.0 (2018-02-22)

Features

  • Simplify installation by adding @types/jest as a package dependency (#116)
  • Move serializers setup to jest config to be possible to override them (#126)

Chores

  • docs: Add a configuration section with vendor libraries like jQuery (#117)

5.0.0 (2017-12-21)

Chores

  • Get rid of explicit jsdom dependency and custom test environment

BREAKING CHANGES

  • Upgrade Jest to 22 (#109)
  • Upgrade ts-jest to 22 (#109)

4.0.2 (2017-12-11)

BREAKING CHANGES

  • Change to MIT license (#102)

4.0.1 (2017-10-08)

Bug Fixes

  • Add doctype to test envrionment (#78)

4.0.0 (2017-10-03)

Bug Fixes

  • fakeAsync not working with zone.js >= 0.8.11

Features

  • Custom test environment with newest version of jsdom (#75)
  • Use universal zone.js instead of node-specific one (#76)

BREAKING CHANGES

  • Drop Node 4 support (because of jsdom upgrade

3.0.2 (2017-09-21)

Bug Fixes

  • issues with moduleNameMapper not overriding mappings (#53)

BREAKING CHANGES

  • Upgrade jest to 21
  • Upgrade ts-jest to 21
  • moduleNameMapper no longer maps absolute paths to src by default, you need to declare the mappings explicitly (#53)

2.0.5 (2017-07-07)

Bug Fixes

  • Bump to ts-jest 20.0.7

2.0.4 (2017-06-13)

Bug Fixes

  • Angular injection errors are now visible
  • scape template literals special chars (#34)

2.0.0 (2017-05-07)

BREAKING CHANGES

  • Upgrade to Jest 20
  • Better snapshot rendering

1.2.0 (2017-04-29)

Features

  • Support absolute URLs in templateUrl

1.1.0 (2017-04-22)

Features

  • Support snapshot testing (#24)

1.0.0 (2017-04-13)

BREAKING CHANGES

  • rxjs is no longer auto included (#18)

0.0.14 (2017-04-12)

Bug Fixes

  • Bump jest-zone-patch version with zone.js peer dependency

0.0.13 (2017-04-05)

Bug Fixes

  • Overhaul regex for styleUrls (#10)

0.0.10 (2017-04-04)

Bug Fixes

  • Improve global mocks

0.0.9 (2017-04-04)

Features

  • Allow all folders within src for module resolution (#6)

0.0.8 (2017-04-04)

Bug Fixes

  • Use tsconfig.spec.json instead of tsconfig.app.json as TS configuration for tests

0.0.1 (2017-03-30)