cypress-io/cypress-react-unit-test

Can't resolve 'readLine'

leo-petrucci opened this issue · 1 comments

I'm having some trouble running tests. If I try running npm run cy:open or npm run cy:run I receive the following error:

Error: Webpack Compilation Error
./node_modules/cypress/lib/tasks/unzip.js
Module not found: Error: Can't resolve 'readline' in '/home/leonardo/drawer-fix/node_modules/cypress/lib/tasks'
resolve 'readline' in '/home/leonardo/drawer-fix/node_modules/cypress/lib/tasks'
  Parsed request is a module
  using description file: /home/leonardo/drawer-fix/node_modules/cypress/package.json (relative path: ./lib/tasks)
    Field 'browser' doesn't contain a valid alias configuration
    Looked for and couldn't find the file at the following paths:
[/home/leonardo/drawer-fix/node_modules/cypress/lib/tasks/node_modules]
[/home/leonardo/drawer-fix/node_modules/cypress/lib/node_modules]
[/home/leonardo/drawer-fix/node_modules/node_modules]
[/home/leonardo/node_modules]
[/home/node_modules]
[/node_modules]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline]
[/home/leonardo/drawer-fix/node_modules/readline]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.web.mjs]
[/home/leonardo/drawer-fix/node_modules/readline.web.mjs]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.mjs]
[/home/leonardo/drawer-fix/node_modules/readline.mjs]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.web.js]
[/home/leonardo/drawer-fix/node_modules/readline.web.js]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.js]
[/home/leonardo/drawer-fix/node_modules/readline.js]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.json]
[/home/leonardo/drawer-fix/node_modules/readline.json]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.web.jsx]
[/home/leonardo/drawer-fix/node_modules/readline.web.jsx]
[/home/leonardo/drawer-fix/node_modules/cypress/node_modules/readline.jsx]
[/home/leonardo/drawer-fix/node_modules/readline.jsx]
 @ ./node_modules/cypress/lib/tasks/unzip.js 21:15-34
 @ ./node_modules/cypress/lib/tasks/install.js
 @ ./node_modules/cypress/index.js
 @ ./src/NavigationDrawer.spec.js

Reproduction repository can be found here: https://github.com/coloredcat/navigation-drawer

Fixed by importing:

import ReactDom from 'react-dom'

And mounting components like this:

    mount(
      <Component />,
      { React, ReactDom }
    )