Configuré una aplicación create-react con mecanografiado, siguiendo la documentación en esta página: https://create-react-app.dev/docs/adding-typescript/ y luego siguiendo esta página: https://jestjs .io/docs/primeros pasos
Cuando intento ejecutar el script: jest sum --notify me sale el siguiente error:
Error: Jest: Failed to parse the TypeScript config file /home/.../jest-playground/jest.config.ts Error: Jest: 'ts-node' is required for the TypeScript configuration files. Make sure it is installed Error: Cannot find module 'ts-node' Pero tengo ts-node instalado en mis dependencias. paquete.json:
"dependencies": { "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "@types/jest": "^26.0.15", "@types/node": "^12.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", "ts-jest": "^27.0.7", "ts-node": "^10.4.0", "typescript": "^4.1.2", "web-vitals": "^1.0.1" },La aplicación funciona bien, pero no puedo hacer que la prueba funcione.
no tiene instalado test-jest y no tiene configuración jest
1, yarn add --dev ts-jest @types/jest 2, yarn ts-jest config:init