11.1.0 (2022-01-20)
11.0.1 (2021-11-22)
11.0.0 (2021-11-18)
- presets: use
ts-jest
types for preset types (#1172) (81854f6) - presets: add
mjs
to the list ofmoduleFileExtensions
(#1155) (3c992a1), closes #1147
- process
js
files innode_modules
withesbuild
(#1169) (1de3bf0) - use
esbuild
to process.mjs
files (#1142) (5d3fe10), closes #1141
js
files fromnode_modules
are now compiled withesbuild
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+
Alan Agius, Pete Bacon Darwin from Angular team
11.0.0-rc.4 (2021-11-15)
js
files fromnode_modules
are now compiled withesbuild
to improve performance.
11.0.0-rc.3 (2021-11-09)
- presets: add
mjs
to the list ofmoduleFileExtensions
(#1155) (3c992a1), closes #1147 - bring back checks on
undefined
/null
forno-ng-attributes
(#1154) (1e7dbf8) - serializers: revert partially changes in
ng-snapshot
(#1150) (44b3b77), closes #1148
11.0.0-rc.2 (2021-11-08)
11.0.0-rc.1 (2021-11-04)
11.0.0-rc.0 (2021-11-04)
- 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+
Alan Agius, Pete Bacon Darwin from Angular team
10.1.0 (2021-10-26)
- 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)
10.0.0 (2021-09-16)
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)
9.0.6 (2021-08-17)
- config: set
allowJs: true
internally always (#976) (9900c8b), closes #974 - utils: throw error when cannot find
@angular/core
forngcc-jest-preprocessor
util (#981) (c35d3f2)
9.0.5 (2021-07-22)
- remove
webpack
and@angular-devkit/build-angular
from peer dependencies and optional dependencies (#973) (ce7fc60)
9.0.4 (2021-06-15)
9.0.3 (2021-06-08)
- add missing
@angular/platform-browser-dynamic
to peer dep (c1729e4)
9.0.2 (2021-06-06)
- allow ESM preset to be used in monorepo structure (#942) (b402e28)
- revert
exports
inpackage.json
(#948) (928e08b), closes /github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348
9.0.1 (2021-05-28)
9.0.0 (2021-05-27)
- support all node versions >= 12.13.0 (#923) (96782a6), closes #920
- presets: remove
moduleNameMapper
config (#910) (df482bc), closes #908
- support Jest 27 (#926) (1c761f8)
- config: load zone ESM when running jest in ESM mode (#892) (e03ec19), closes #751
- add
exports
field topackage.json
, see https://nodejs.org/api/packages.html#packages_package_entry_points - presets: add type definition for
presets
entry point (#801) (e4ff0c0) - compiler: support ESM (#721) (a2166f8)
- presets: add ESM preset (#723) (b0073b0)
- compiler: use
replace-resources
AST transformer from Angular (#708) (1b20c19) - compiler: use
downlevel-ctor
AST transformer from Angular (#730) (1f964c3)
- compiler: reuse
cacheFS
from jest to reduce file system reading (#679) (f5d9d4b) - config: set
skipLibCheck: true
if not defined in tsconfig (#678) (0df3ce1)
- 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 toimport 'jest-preset-angular/setup-jest'
- transformers: The AST transformers
InlineFilesTransformer
andStripStylesTransformer
are REMOVED and defaultjest-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 aroundts-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 removingmoduleNameMapper
from preset will make sure that the preset works in pair withtsconfig.json
. Ones who are relying on the value ofmoduleNameMapper
from the preset should create their ownmoduleNameMapper
config manually or viats-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 totrue
. If one wants to have it asfalse
, one can set explicitly in tsconfig. - compiler:
jest-preset-angular
now switches to default to use its own transformer which wraps aroundts-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)
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)
- 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)
9.0.0-next.11 (2021-03-21)
- add
exports
field topackage.json
, see https://nodejs.org/api/packages.html#packages_package_entry_points
8.4.0 (2021-03-04)
- 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 ofimport 'jest-preset-angular/setup-jest'
9.0.0-next.8 (2021-02-12)
- 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)
- compiler: support ESM for
isolatedModules: false
(#721) (a2166f8) - compiler: use
replace-resources
forisolatedModules: true
(#717) (76c25d2) - presets: add ESM preset (#723) (b0073b0)
9.0.0-next.5 (2021-01-06)
- compiler: use
replace-resources
transformer from Angular (#708) (1b20c19) - utils: add
es2015
tongcc
script's properties (#701) (a13070b)
isolatedModules: true
will useinline-files
andstrip-styles
transformers as default transformers.isolatedModules: false
will usereplace-resources
transformer from@ngtools/webpack
(besides the existingdownlevel-ctor
transformer). This will makejest-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
andjest-preset-angular/build/transformers/inline-files
should be removed from jest config.
9.0.0-next.4 (2020-12-18)
- compiler: reuse
cacheFS
from jest to reduce file system reading (#679) (f5d9d4b) - config: set
skipLibCheck: true
if not defined in tsconfig (#678) (0df3ce1)
- By default, if
skipLibCheck
is not defined in tsconfig,jest-preset-angular
will set it totrue
. If one wants to have it asfalse
, one can set explicitly in tsconfig. - Require Jest 27
9.0.0-next.1 (2020-10-29)
- compiler:
jest-preset-angular
now switches to default to use its own transformer which wraps aroundts-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)
- config: switch to
tsconfig
forjest-preset.js
9.0.0-next.0 (2020-10-18)
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 toimport '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
andStripStylesTransformer
are REMOVED and defaultjest-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)
- Correct wrong published content in v8.3.0
8.3.0 (2020-08-23)
8.2.1 (2020-06-19)
8.2.0 (2020-05-07)
8.1.3 (2020-03-31)
8.1.2 (2020-03-15)
8.1.1 (2020-03-12)
8.1.0 (2020-03-10)
8.0.0 (2019-10-21)
- breaking: Refine ast-transformer behavior: only transform
styles
-assignments inside @Component (#261) and TypeScript v2.9createStringLiteral
is polyfilled if an older version is used (#272). - breaking: Restructure project with
src
andbuild
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, minimalreflect-metadata
(#315).
- Update jsdom to current version 15 (#318).
- If the
astTransformers
are referenced in a customjest
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 thejest-preset-angular/build/
-folder in a custom config. Existing references have to be aligned. - If your
tsconfig.spec.json
is located insrc
, 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 inpackage.json
, unless it's imported manually in the code.
7.1.0 (2019-05-20)
- component serializer without ng-* attributes (#97) (1079528)
- support
core-js
>=2.0.0 < 4.0.0 (#246) (239a647)
- 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)
- adjust semver range of
jest-zone-patch
(#209) (1c60de7) - Import jest-zone-patch (#214) (66987ed), closes /github.com/thymikee/jest-zone-patch/pull/9#issuecomment-445772763
- Jest 24 (#224) (7f7d0f4), closes #223
- jsdom-v13 (#229) (864440e), closes #216
- breaking: Implement
astTransformer
compatible withts-jest
23.10 (#204) (adad842), closes #195 #201 #201 #201
- Remove template literal character escaping, reverts #34
- Migrate CI config to CircleCI v2 (#212)
- docs: do not use
.babelrc
file but ratherbabel.config.js
(#231) - docs: add
astTransformers
in configuration example (#218)
- If
global
andtransform
are not set in your configuration injest.config.json
,jest.config.js
orpackage.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 thets-jest
-configuration. - Change the assignment identifier from
tsConfigFile
totsConfig
. - Add the
astTransformers: [require.resolve('jest-preset-angular/InlineHtmlStripStylesTransformer')]
so Jest can work withtemplateUrl
-assignments in Component decorators.
- The option
- If
transform
was overridden, remove the entry pointing atpreprocessor.js
and add"^.+\\.(ts|js|html)$": "ts-jest"
to thetransform
-object. - If in doubt, check the configuration example in
jest-preset.json
.
6.0.1 (2018-09-19)
- restrict version of
ts-jest
to ~23.1.3 (#196) (62673cf) - support backtick quoted
templateUrl
(#182) (145c8ea)
- Add HeroesComponent example with mocked service provider (#110)
- docs: Adjust troubleshooting to support configuration with Angular 6 (#187)
6.0.0 (2018-08-03)
- Compatibility with
jest
v23 (#173)
5.2.3 (2018-06-26)
5.2.2 (2018-04-27)
- update
STYLE_URLS_REGEX
to not break on multiple new lines (#139)
5.2.1 (2018-03-08)
- update
ts-jest
to22.4.1
– urgent fix forenableTsDiagnostics
(#130)
- Change
testRegex
totestMatch
(#131)
5.2.0 (2018-02-26)
- Upgrade ts-jest and remove
mapCoverage
fromjest-preset
(requiresjest@^22.4.0
as a dependency now) (#127)
5.1.0 (2018-02-22)
- Simplify installation by adding @types/jest as a package dependency (#116)
- Move serializers setup to jest config to be possible to override them (#126)
- docs: Add a configuration section with vendor libraries like jQuery (#117)
5.0.0 (2017-12-21)
- Get rid of explicit
jsdom
dependency and custom test environment
4.0.2 (2017-12-11)
- Change to MIT license (#102)
4.0.1 (2017-10-08)
- Add doctype to test envrionment (#78)
4.0.0 (2017-10-03)
fakeAsync
not working withzone.js
>= 0.8.11
- Custom test environment with newest version of
jsdom
(#75) - Use universal
zone.js
instead of node-specific one (#76)
- Drop Node 4 support (because of
jsdom
upgrade
3.0.2 (2017-09-21)
- issues with
moduleNameMapper
not overriding mappings (#53)
- Upgrade
jest
to 21 - Upgrade
ts-jest
to 21 moduleNameMapper
no longer maps absolute paths tosrc
by default, you need to declare the mappings explicitly (#53)
2.0.5 (2017-07-07)
- Bump to
ts-jest
20.0.7
2.0.4 (2017-06-13)
- Angular injection errors are now visible
- scape template literals special chars (#34)
2.0.0 (2017-05-07)
- Upgrade to Jest 20
- Better snapshot rendering
1.2.0 (2017-04-29)
- Support absolute URLs in
templateUrl
1.1.0 (2017-04-22)
- Support snapshot testing (#24)
1.0.0 (2017-04-13)
rxjs
is no longer auto included (#18)
0.0.14 (2017-04-12)
- Bump
jest-zone-patch
version withzone.js
peer dependency
0.0.13 (2017-04-05)
- Overhaul regex for styleUrls (#10)
0.0.10 (2017-04-04)
- Improve global mocks
0.0.9 (2017-04-04)
- Allow all folders within src for module resolution (#6)
0.0.8 (2017-04-04)
- Use
tsconfig.spec.json
instead oftsconfig.app.json
as TS configuration for tests