Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to initialize watch plugin "node_modules/jest-watch-typeahead/filename.js":

Tags:

I am using react with typescript in my project and also I am doing snapshot testing but when I run npm test command in vscode terminal I am getting error which I have attached in the attachement. could you please let me know what should I do so that all the test case run successfully or any other thing I need to configure

enter image description here

Here is my package.json

{
  "name": "vcc-collaboration-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fluentui/react": "^8.42.1",
    "@fluentui/react-file-type-icons": "^8.5.6",
    "@testing-library/jest-dom": "^5.15.0",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "@types/react-test-renderer": "^17.0.1",
    "ag-grid-community": "^26.2.0",
    "ag-grid-react": "^26.2.0",
    "axios": "^0.24.0",
    "babel-jest": "^26.6.0",
    "jest": "^26.6.0",
    "jest-watch-typeahead": "^1.0.0",
    "moment": "^2.29.1",
    "node-sass": "^6.0.1",
    "react": "^17.0.2",
    "react-bootstrap": "^2.0.2",
    "react-dom": "^17.0.2",
    "react-dropzone": "^11.4.2",
    "react-grid": "^4.0.4",
    "react-icons": "^4.3.1",
    "react-router-dom": "^5.0.0",
    "react-scripts": "4.0.3",
    "react-test-renderer": "^17.0.2",
    "vcc-ui": "^2.11.0",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/jest": "^27.0.3",
    "@types/node": "^16.11.7",
    "@types/react": "^17.0.35",
    "@types/react-dom": "^17.0.11",
    "@types/react-dropzone": "^5.1.0",
    "@types/react-router": "^5.1.17",
    "@types/react-router-dom": "^5.3.2",
    "typescript": "^4.5.2"
  }
}

EngineeringArea.test.tsx

import React from "react";
import * as ShallowRenderer from "react-test-renderer/shallow";
import EngineeringArea from "./EngineeringArea";

describe("EngineeringArea Screen", () => {
  it("EngineeringArea Screen renders correctly", () => {
    const renderer = ShallowRenderer.createRenderer();
    const component = renderer.render(<EngineeringArea />);
    expect(component).toMatchSnapshot();
  });
});
like image 911
Abhishek kumar Avatar asked Dec 02 '21 17:12

Abhishek kumar


1 Answers

You need to install specifically v0.6.5 of jest-watch-typeahead

npm i -D --exact [email protected]
like image 131
Matt Avatar answered Sep 16 '22 11:09

Matt