Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

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();
  });
});
over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

Last answer was wrong. Here's the correct answer. https://github.com/facebook/create-react-app/issues/11043#issuecomment-942472592

over 4 years ago · Santiago Trujillo Report

0

Had this error come up. My answer was using nvm to switch from node's current release (my system default) to its LTS (16.14.0) with nvm use 16

over 4 years ago · Santiago Trujillo Report

0

Also got this error message when trying to test. Changing node version worked for me. Here is link to the article: https://github.com/facebook/create-react-app/issues/11792

over 4 years ago · Santiago Trujillo Report

0

I faced this issue while I was trying to create a new React Application using CRA with npx.

I followed what Matt suggested in his answer but jest started throwing an error saying, it's better to remove any babel-jest dependency, which is weird but I guess jest-watch-typehead` uses babel maybe (it's a wild guess, I have not checked).

Anyway, here's what I did based on the suggestion I got on console from the error thrown by babel-jest.

  • Removed package-lock.json file.
  • Removed node_modules/.
  • Did a fresh npm i.
  • I ran my tests again and got an error for not importing React in App.test.js, so I simply imported and it worked.
over 4 years ago · Santiago Trujillo Report

0

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

npm i -D --exact jest-watch-typeahead@0.6.5
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!