Jest warns about the astTransformers:
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
ts-jest[config] (WARN) The configuration for astTransformers as string[] is deprecated and will be removed in ts-jest 27. Please define your custom AST transformers in a form of an object. More information you can check online documentation https://kulshekhar.github.io/ts-jest/user/config/astTransformers
It's one warnings per spec file.
Jest was updated to 26 as part of the 10.1.0 migration:
"10.1.0": {
"version": "10.1.0-beta.0",
"packages": {
"jest": {
"version": "26.2.2",
"alwaysAddToPackageJson": false
},
"ts-jest": {
"version": "26.1.4",
"alwaysAddToPackageJson": false
},
"@types/jest": {
"version": "26.0.8",
"alwaysAddToPackageJson": false
},
"jest-preset-angular": {
"version": "8.2.1",
"alwaysAddToPackageJson": false
},
"babel-jest": {
"version": "26.2.2",
"alwaysAddToPackageJson": false
}
}
}
jest.config.js
module.exports = {
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/frontend-libs/my-project',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
displayName: 'my-project',
};
It should not output these many warnings. There is an older issue about this as well #3499 that says it should support Jest 26.
Ideally it shouldn't warn at all.
This issue may not be prioritized if details are not provided to help us reproduce the issue.
nx : Not Found
@nrwl/angular : 10.3.0
@nrwl/cli : 10.3.0
@nrwl/cypress : 10.3.0
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 10.3.0
@nrwl/linter : 10.3.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.3.0
@nrwl/web : Not Found
@nrwl/workspace : 10.3.0
typescript : 4.0.3
I'm looking at the migration update-10-3-0/update-ts-jest.ts and it looks like this should have been fixed in the 10.3.0 migration. Was that the intent @FrozenPandaz?
But it didn't throw any error when running the migration:
Running migration @nrwl/workspace:add-cli-dependency
An installation of node_modules has been required. Make sure to run it after the migration
Successfully finished @nrwl/workspace:add-cli-dependency
---------------------------------------------------------
Running migration @nrwl/workspace:update-10-3-0
Successfully finished @nrwl/workspace:update-10-3-0
---------------------------------------------------------
Running migration @nrwl/workspace:add-vscode-extensions
Successfully finished @nrwl/workspace:add-vscode-extensions
---------------------------------------------------------
Running migration @nrwl/workspace:add-buildable-project-deps-in-package-json-type
Successfully finished @nrwl/workspace:add-buildable-project-deps-in-package-json-type
---------------------------------------------------------
Running migration @nrwl/angular:update-10-3-0
Successfully finished @nrwl/angular:update-10-3-0
---------------------------------------------------------
Running migration @nrwl/jest:update-projects-property
The root jest.config.js file will be updated to include all references to each individual project's jest config.
A new jest.preset.js file will be created that would have your existing configuration. All projects will now have this preset.
Successfully finished @nrwl/jest:update-projects-property
---------------------------------------------------------
Running migration @nrwl/jest:update-ts-jest
Successfully finished @nrwl/jest:update-ts-jest
---------------------------------------------------------
Running migration @nrwl/jest:add-jest-extension
Successfully finished @nrwl/jest:add-jest-extension
---------------------------------------------------------
Yes, this should be fixed in 10.3.0. Please confirm that the issue is resolved. 馃帀
@FrozenPandaz I think you misunderstood me. I did the migration but it didn't take, it said successful but didn't actually make the change.
As @krokofant says, the problem persists. I just migrated to 10.3.0 from 10.2.1 and this changes:

astTransformers only changes in apps' jest.config.js, not in libs' jest.config.js. In apps it looks so:
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
Adds before
In our project the migration fixed all apps and some libs. Some libs seemed to be skipped during migration, but I was not able to investigate what the crucial difference is - just fixed it with global search & replace.
The non-migration of libs is visible in the examples repo as well https://github.com/nrwl/nx-examples/search?q=astTransformers
None of the libs have migration actually applied but the "products" app have it applied.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 馃檹
Issue is still valid.
Hello ! I have been dealing with this warning today , to fix the warning you need to update the jest.config.js file:
before:
globals: {
'ts-jest': {
// ...
astTransformers: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
after:
globals: {
'ts-jest': {
// ...
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
},
You can find more information about this change here.
The issue is that every time you run an nx scheme to generate a library you have to change it. I think the scheme must be updated.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 馃檹
Most helpful comment
@FrozenPandaz I think you misunderstood me. I did the migration but it didn't take, it said successful but didn't actually make the change.