9.0.2 (2021-06-06)
- allow ESM preset to be used in monorepo structure (#942) (b402e28)
- revert
exportsinpackage.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
moduleNameMapperconfig (#910) (df482bc), closes #908
- support Jest 27 (#926) (1c761f8)
- config: load zone ESM when running jest in ESM mode (#892) (e03ec19), closes #751
- add
exportsfield topackage.json, see https://nodejs.org/api/packages.html#packages_package_entry_points - presets: add type definition for
presetsentry point (#801) (e4ff0c0) - compiler: support ESM (#721) (a2166f8)
- presets: add ESM preset (#723) (b0073b0)
- compiler: use
replace-resourcesAST transformer from Angular (#708) (1b20c19) - compiler: use
downlevel-ctorAST transformer from Angular (#730) (1f964c3)
- compiler: reuse
cacheFSfrom jest to reduce file system reading (#679) (f5d9d4b) - config: set
skipLibCheck: trueif 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
InlineFilesTransformerandStripStylesTransformerare REMOVED and defaultjest-preset-angularuses AST transformers from@angular/compiler-cliand@ngtools/webpack. One should remove the old transformers from the jest config. - compiler:
jest-preset-angularnow switches to default to use its own transformer which wraps aroundts-jestto 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.jsondoesn't contain any path mappings hence removingmoduleNameMapperfrom preset will make sure that the preset works in pair withtsconfig.json. Ones who are relying on the value ofmoduleNameMapperfrom the preset should create their ownmoduleNameMapperconfig manually or viats-jestutil 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
skipLibCheckis not defined in tsconfig,jest-preset-angularwill set it totrue. If one wants to have it asfalse, one can set explicitly in tsconfig. - compiler:
jest-preset-angularnow switches to default to use its own transformer which wraps aroundts-jestto 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
exportsfield 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
presetsentry point (#801) (e4ff0c0)
9.0.0-next.6 (2021-01-14)
- compiler: support ESM for
isolatedModules: false(#721) (a2166f8) - compiler: use
replace-resourcesforisolatedModules: true(#717) (76c25d2) - presets: add ESM preset (#723) (b0073b0)
9.0.0-next.5 (2021-01-06)
- compiler: use
replace-resourcestransformer from Angular (#708) (1b20c19) - utils: add
es2015tongccscript's properties (#701) (a13070b)
isolatedModules: truewill useinline-filesandstrip-stylestransformers as default transformers.isolatedModules: falsewill usereplace-resourcestransformer from@ngtools/webpack(besides the existingdownlevel-ctortransformer). This will makejest-preset-angularbecome 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-filesandjest-preset-angular/build/transformers/inline-filesshould be removed from jest config.
9.0.0-next.4 (2020-12-18)
- compiler: reuse
cacheFSfrom jest to reduce file system reading (#679) (f5d9d4b) - config: set
skipLibCheck: trueif not defined in tsconfig (#678) (0df3ce1)
- By default, if
skipLibCheckis not defined in tsconfig,jest-preset-angularwill 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-angularnow switches to default to use its own transformer which wraps aroundts-jestto 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
tsconfigforjest-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
InlineFilesTransformerandStripStylesTransformerare REMOVED and defaultjest-preset-angularuses AST transformers from@angular/compiler-cli. One should remove the old transformers from the jest config. - serializers: One is using all
jest-preset-angularsnapshot 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.9createStringLiteralis polyfilled if an older version is used (#272). - breaking: Restructure project with
srcandbuildfolder (#307). - breaking: Support
tsconfig.spec.jsonin root folder by default (#309). - breaking: Enable
AngularNoAngularNoNgAttributesSnapshotSerializer(created in #97) by default (#318). - Remove
core-jsdependency by using internal, minimalreflect-metadata(#315).
- Update jsdom to current version 15 (#318).
- If the
astTransformersare referenced in a customjestconfig,[ 'jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer']have to be set instead. - Serializers, transformers and
setupJesthave to be referenced from thejest-preset-angular/build/-folder in a custom config. Existing references have to be aligned. - If your
tsconfig.spec.jsonis 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-jsshould 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
astTransformercompatible withts-jest23.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
.babelrcfile but ratherbabel.config.js(#231) - docs: add
astTransformersin configuration example (#218)
- If
globalandtransformare not set in your configuration injest.config.json,jest.config.jsorpackage.json, you are done. - If the
globalvalue of the configuration was overridden, adjust- The option
"__TRANSFORM_HTML__": trueis not required anymore. Instead the"stringifyContentPathRegex": "\\.html$"should be used inside thets-jest-configuration. - Change the assignment identifier from
tsConfigFiletotsConfig. - Add the
astTransformers: [require.resolve('jest-preset-angular/InlineHtmlStripStylesTransformer')]so Jest can work withtemplateUrl-assignments in Component decorators.
- The option
- If
transformwas overridden, remove the entry pointing atpreprocessor.jsand 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-jestto ~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
jestv23 (#173)
5.2.3 (2018-06-26)
5.2.2 (2018-04-27)
- update
STYLE_URLS_REGEXto not break on multiple new lines (#139)
5.2.1 (2018-03-08)
- update
ts-jestto22.4.1– urgent fix forenableTsDiagnostics(#130)
- Change
testRegextotestMatch(#131)
5.2.0 (2018-02-26)
- Upgrade ts-jest and remove
mapCoveragefromjest-preset(requiresjest@^22.4.0as 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
jsdomdependency 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)
fakeAsyncnot working withzone.js>= 0.8.11
- Custom test environment with newest version of
jsdom(#75) - Use universal
zone.jsinstead of node-specific one (#76)
- Drop Node 4 support (because of
jsdomupgrade
3.0.2 (2017-09-21)
- issues with
moduleNameMappernot overriding mappings (#53)
- Upgrade
jestto 21 - Upgrade
ts-jestto 21 moduleNameMapperno longer maps absolute paths tosrcby default, you need to declare the mappings explicitly (#53)
2.0.5 (2017-07-07)
- Bump to
ts-jest20.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)
rxjsis no longer auto included (#18)
0.0.14 (2017-04-12)
- Bump
jest-zone-patchversion withzone.jspeer 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.jsoninstead oftsconfig.app.jsonas TS configuration for tests