Property 'toStrictEqual' does not exist on type 'Matchers<any>'
See original GitHub issueBug
package
version: 0.11.2node
version: 12.3.1npm
version: 6.11.2typescript
version: 3.5.3
Relevant code or config
module.exports = {
globals: {
'ts-jest': {
tsConfig: './src/tsconfig.spec.json',
stringifyContentPathRegex: '\\.html$',
astTransformers: [
require.resolve('jest-preset-angular/InlineHtmlStripStylesTransformer')
]
},
},
setupFilesAfterEnv: [
'<rootDir>/node_modules/@angular-builders/jest/dist/jest-config/setup.js',
'jest-extended',
],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
testMatch: [
'**/__tests__/**/*.+(ts|js)?(x)',
'**/+(*.)+(spec).+(ts|js)?(x)'
],
testEnvironment: 'jest-environment-jsdom-thirteen',
moduleFileExtensions: ['ts', 'js', 'html'],
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/mocks/files-mock.js",
"\\.(css|scss)$": "<rootDir>/test/mocks/styles-mock.js",
'^core-js/es6/(.*)': '<rootDir>/././node_modules/core-js/es/$1',
'^core-js/es7/reflect': '<rootDir>/././node_modules/core-js/proposals/reflect-metadata',
'^@core/(.*)': '<rootDir>/./src/app/core/$1',
'^@shared/(.*)': '<rootDir>/./src/app/shared/$1',
'^@feature/(.*)': '<rootDir>/./src/app/feature/$1',
'^@test/(.*)': '<rootDir>/./src/app/feature/$1'
},
transformIgnorePatterns: ['node_modules/(?!@ngrx)'],
collectCoverageFrom: [
'{src|projects}/**/{src|lib}/**/*.{ts}',
'!{src|projects}/*.{ts}',
'!{src|projects}/**/*.{js}',
'!{src|projects}/**/environments/*.{ts}',
'!{src|projects}/**/model/*.{ts}',
'!{src|projects}/**/*.module.{ts}',
'!{src|projects}/**/*public_api.{ts}',
'!{src|projects}/**/main.{ts}',
'!{src|projects}/**/polyfills.{ts}',
'!{src|projects}/**/*index.{ts}',
'!{src|projects}/**/*test.{ts}',
'!{src|projects}/**/*.enum.{ts}',
'!{src|projects}/**/*.state.{ts}',
'!{src|projects}/**/*.entity.{ts}',
'!**/**e2e/**/*.{ts}',
'!**/node_modules/**',
'!**/vendor/**',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
testPathIgnorePatterns: ['/node_modules/', '/dist/', 'src/app/*.{js}'],
testResultsProcessor: 'jest-sonar-reporter',
snapshotSerializers: [
'jest-preset-angular/AngularSnapshotSerializer.js',
'jest-preset-angular/HTMLCommentSerializer.js'
]
};
What you did: I am trying to run a test utilizing a jest-extended matcher function (i.e. toStrictEqual).
What happened (please provide anything you think will help): I cannot get the compiler to recognize jest-extended matchers, no matter what I seem to try; for example: - error TS2339: Property ‘toStrictEqual’ does not exist on type ‘Matchers<any>’.
I have followed everything in the README and here https://github.com/jest-community/jest-extended/issues/172 in order to get the typings to work and they finally seem to work, but I still can’t get the compiler to recognize the matcher functions.
Reproduction repository (if possible):
N/A
What am I missing?
Possibly related to https://github.com/jest-community/jest-extended/issues/171 and https://github.com/jest-community/jest-extended/issues/189 which seem to have been ignored.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9
Top GitHub Comments
Any updates on this? I’m using “ts-jest”: “^26.1.0”, and also having same issue
@jjcv2304 I just added
global
to jest config in package.json