gaearon/react-hot-loader

npm test gives error - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

Open

#1,053 建立於 2018年8月25日

在 GitHub 查看
 (1 留言) (3 反應) (0 負責人)JavaScript (12,265 star) (844 fork)batch import
help wanted

描述

Description

Including react-hot-loader to create-react-app without ejecting - Followed this guide to implement

After running npm test (which runs the default test of create-react-app) getting the below

 TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

This github issue page - talks about - "The issue is not actually caused by react-app-rewired, but due to a problem with the mismatch in versions between jest-cli and babel-jest." - But I understand if using CRA, I can not update Jest manually.

Have also gone throught this stackOverflow question question and did npm install jest@latest --save-dev - But that didn't help.

What you are reporting:

bug

Environment

After running npm ls jest-environment-node

`-- react-scripts@1.1.5
  `-- jest@20.0.4
    `-- jest-cli@20.0.4
      `-- jest-config@20.0.4
        `-- jest-environment-node@20.0.3 

my package.json

{
  "name": "redux-boilerplate-base-counter-without-ejecting",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "babel-jest": "^23.4.2",
    "enzyme": "^3.5.0",
    "enzyme-adapter-react-16": "^1.3.0",
    "node-sass-chokidar": "^1.3.3",
    "react": "^16.4.2",
    "react-app-rewire-hot-loader": "^1.0.1",
    "react-app-rewired": "^1.5.2",
    "react-dom": "^16.4.2",
    "react-hot-loader": "^4.3.5",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.1.5",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "test": "^0.6.0"
  },
  "scripts": {
    "build-css": "node-sass-chokidar src/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

Run these commands in the project folder and fill in their results:

  1. node -v: v10.1.0
  2. npm -v: 5.6.0

Then, specify:

  1. Operating system: Ubuntu 16:04
  2. Browser and version: Chrome Version 68.0.3440.106 (Official Build) (64-bit)

Reproducible Demo

https://codesandbox.io/s/qq9w7709xq

貢獻者指南