bahmutov / bahmutov/cypress-code-coverage

Components with React emotion throw an error "Cannot find module 'path' "

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14
Forks
1
PR merge metrics
No merged PRs in 30d

Description

For component test code instrumentation, there is a blocker with projects that use React emotion, or reach. Some component tests are fine, some run into the attached error. Can you reproduce it?

```bash
git clone https://github.com/muratkeremozcan/bookshelf.git
cd bookshelf
git checkout feat/ct-cov
npm i
npm run cy:open-ct
```

Tests don't use emotion or reach are fine: `logo.cy.js` .
Most other tests run in to this:
image

```
at webpackMissingModule (http://localhost:3001/__cypress/src/static/js/vendors-node_modules_emotion_styled_macro_js-node_modules_reach_dialog_dist_reach-dialog_esm_js.chunk.js:1828:51)
at ./node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js (http://localhost:3001/__cypress/src/static/js/vendors-node_modules_emotion_styled_macro_js-node_modules_reach_dialog_dist_reach-dialog_esm_js.chunk.js:1828:130)
at __webpack_require__ (http://localhost:3001/__cypress/src/main.js:7780:43)
at ./node_modules/@emotion/styled/macro.js (http://localhost:3001/__cypress/src/static/js/vendors-node_modules_emotion_styled_macro_js-node_modules_reach_dialog_dist_reach-dialog_esm_js.chunk.js:3264:19)
at __webpack_require__ (http://localhost:3001/__cypress/src/main.js:7780:43)
at ./src/components/lib.js (http://localhost:3001/__cypress/src/static/js/node_modules_emotion_babel-plugin_dist_sync_recursive_package_json_-src_components_lib_js-nod-5de598.chunk.js:42:38)
at __webpack_require__ (http://localhost:3001/__cypress/src/main.js:7780:43)
at ./src/components/login-form.js (http://localhost:3001/__cypress/src/static/js/spec-8.chunk.js:417:13)
at __webpack_require__ (http://localhost:3001/__cypress/src/main.js:7780:43)
at ./src/components/login-form.cy.js (http://localhost:3001/__cypress/src/static/js/spec-8.chunk.js:14:42)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.