cypress: browserslist extends not working with cypress
Steps to reproduce
I’m using browserslist like so many others. I have my browserslist config published as an npm package and use it like this in my package.json:
"browserslist": [
"extends @marcneander/browserslist-config"
],
When running yarn run cypress run
with only your example tests I get this error (for all tests):
Error: [BABEL] /Users/marc/src/marcneander/marcneander.io/cypress/integration/examples/actions.spec.js: Cannot find module '@marcneander/browserslist-config' (While processing: "/Users/marc/Library/Caches/Cypress/3.1.3/Cypress.app/Contents/Resources/app/packages/server/node_modules/@babel/preset-env/lib/index.js") while parsing file: /Users/marc/src/marcneander/marcneander.io/cypress/integration/examples/actions.spec.js
Versions
Cypress: 3.1.3 Mac OS: 10.14.2 Node: 11.4.0
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 4
- Comments: 19 (5 by maintainers)
Commits related to this issue
- Update http_requests_spec.coffee fixes #2983 But perhaps it would be better to specify a target ? — committed to christophehurpeau/cypress by christophehurpeau 5 years ago
@jennifer-shehane
Please can you can you Reopen this issue, as it’s preferable that a fix is found. As many applications utilise
extends @browserlist
. For there web applications. Thanks!You can modify the options for
@babel/preset-env
like so:npm install --save-dev @cypress/browserify-preprocessor
I looked into this a bit. I haven’t figured out a solution, but here are my notes for documentation’s sake:
browserslist
tries to require the extended config (e.g.@company/browserslist-config
).paths
option to include the project path, so it would look for node modules there, but it didn’t seem to work.Need to do more research to find a fix that can be baked into Cypress and/or the browserify preprocessor. For now, here is a simpler workaround than the one I posted above that doesn’t require ignoring browserslist:
npm install --save-dev @cypress/browserify-preprocessor
The issue is still relevant! We can’t use browserlist configs in an appropriate way with cypress right now. Any workarounds are ridiculous in this case, it should be a part of cypress itself.
@chrisbreiding I also just ran into this issue and it seems like the last update was back on January 3rd by you. I don’t mean to +1 but this has gone stale/quiet and wanted to revive this to see if any headway has been made on this from the Cypress side? There have been many releases since that date and this issue remains open. It would be great to get an official update here as I agree with the others, this should be baked into Cypress and not require a workaround since this is the properly documented usage of external Browserslist configs.
@jennifer-shehane Not sure I agree.
I’m using browserslist in a documented way and when I do I cannot use cypress without the above workaround. A fix would be to resolve the browserslist extends in the correct way.
Still happens
any reason to use
browserify-preprocessor
instead ofwebpack-preprocessor
?