while running jest runner extension to run jest test case in react monorepo, its showing me error as
PS F:MySpace-Web> node “node_modules/jest/bin/jest.js” “f:/MySpace-Web/apps/myspace/src/app/views/login/login.spec.tsx” -c “f:/MySpace-Web/apps/myspace/jest.config.ts” -t “Login Component should render the login form”
Error: Jest: Failed to parse the TypeScript config file f:/MySpace-Web/apps/myspace/jest.config.ts
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./extend-expect’ is not defined by “exports” in f:[email protected]
at readConfigFileAndSetRootDir (F:MySpace-Webnode_modulesjest-configbuildreadConfigFileAndSetRootDir.js:116:13)
at async readInitialOptions (F:MySpace-Webnode_modulesjest-configbuildindex.js:392:15)
at async readConfig (F:MySpace-Webnode_modulesjest-configbuildindex.js:147:48)
at async readConfigs (F:MySpace-Webnode_modulesjest-configbuildindex.js:424:26)
at async runCLI (F:[email protected]:151:59)
at async Object.run (F:MySpace-Webnode_modulesjest-clibuildrun.js:130:37)
jest.config.ts
/* eslint-disable */
import '@testing-library/jest-dom/extend-expect';
export default {
displayName: 'myspace',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/myspace',
setupFilesAfterEnv: ['<rootDir>/support/setupTests.js'],
};
package.json
{
"name": "@testing-library/jest-dom",
"version": "6.1.5",
"description": "Custom jest matchers to test the state of the DOM",
"main": "dist/index.js",
"module": "dist/index.mjs",
"exports": {
".": {
"require": {
"types": "./types/index.d.ts",
"default": "./dist/index.js"
},
"import": {
"types": "./types/index.d.ts",
"default": "./dist/index.mjs"
}
},
"./jest-globals": {
"require": {
"types": "./types/jest-globals.d.ts",
"default": "./dist/jest-globals.js"
},
"import": {
"types": "./types/jest-globals.d.ts",
"default": "./dist/jest-globals.mjs"
}
},
"./matchers": {
"require": {
"types": "./types/matchers.d.ts",
"default": "./dist/matchers.js"
},
"import": {
"types": "./types/matchers.d.ts",
"default": "./dist/matchers.mjs"
}
},
"./vitest": {
"require": {
"types": "./types/vitest.d.ts",
"default": "./dist/vitest.js"
},
"import": {
"types": "./types/vitest.d.ts",
"default": "./dist/vitest.mjs"
}
},
"./package.json": "./package.json"
},
"types": "types/index.d.ts",
"engines": {
"node": ">=14",
"npm": ">=6",
"yarn": ">=1"
},
"scripts": {
"build": "rollup -c",
"format": "kcd-scripts format",
"lint": "kcd-scripts lint",
"setup": "npm install && npm run validate -s",
"test": "kcd-scripts test",
"test:update": "npm test -- --updateSnapshot --coverage",
"test:types": "tsc -p types/__tests__/jest && tsc -p types/__tests__/jest-globals && tsc -p types/__tests__/vitest",
"validate": "kcd-scripts validate && npm run test:types"
},
"files": [
"dist",
"types",
"*.d.ts",
"jest-globals.js",
"matchers.js",
"vitest.js"
],
"keywords": [
"testing",
"dom",
"jest",
"jsdom"
],
"author": "Ernesto Garcia <[email protected]> (http://gnapse.github.io)",
"license": "MIT",
"dependencies": {
"@adobe/css-tools": "^4.3.1",
"@babel/runtime": "^7.9.2",
"aria-query": "^5.0.0",
"chalk": "^3.0.0",
"css.escape": "^1.5.1",
"dom-accessibility-api": "^0.5.6",
"lodash": "^4.17.15",
"redent": "^3.0.0"
},
"devDependencies": {
"@jest/globals": "^29.6.2",
"@rollup/plugin-commonjs": "^25.0.4",
"expect": "^29.6.2",
"jest-environment-jsdom-sixteen": "^1.0.3",
"jest-watch-select-projects": "^2.0.0",
"jsdom": "^16.2.1",
"kcd-scripts": "^14.0.0",
"pretty-format": "^25.1.0",
"rollup": "^3.28.1",
"rollup-plugin-delete": "^2.0.0",
"typescript": "^5.1.6",
"vitest": "^0.34.1"
},
"peerDependencies": {
"@jest/globals": ">= 28",
"@types/jest": ">= 28",
"jest": ">= 28",
"vitest": ">= 0.32"
},
"peerDependenciesMeta": {
"@jest/globals": {
"optional": true
},
"@types/jest": {
"optional": true
},
"jest": {
"optional": true
},
"vitest": {
"optional": true
}
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"rules": {
"no-invalid-this": "off"
},
"overrides": [
{
"files": [
"src/__tests__/*.js"
],
"rules": {
"max-lines-per-function": "off"
}
},
{
"files": [
"**/*.d.ts"
],
"rules": {
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/triple-slash-reference": "off"
}
}
]
},
"eslintIgnore": [
"node_modules",
"coverage",
"dist",
"types/__tests__"
],
"repository": {
"type": "git",
"url": "https://github.com/testing-library/jest-dom"
},
"bugs": {
"url": "https://github.com/testing-library/jest-dom/issues"
},
"homepage": "https://github.com/testing-library/jest-dom#readme"
}
tried reinstalling the node modules which are showing in the error file, also installed some other extensions but they are showing the same result. tried to change preset in jest.config.ts also but its not working.