New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browserslist extends not working with cypress #2983
Comments
have you validated JSON data? you can use online tools like https://jsonformatter.org |
@jimmibond Not sure where you think I might have invalid JSON but the package.json file is valid JSON and the package https://github.com/browserslist/browserslist#shareable-configs |
I have exactly same problem with my project. |
Same issue. There is an option in |
fixes cypress-io#2983 But perhaps it would be better to specify a target ?
You can modify the options for
const browserify = require('@cypress/browserify-preprocessor')
module.exports = (on) => {
const options = browserify.defaultOptions
const envPreset = options.browserifyOptions.transform[1][1].presets[0]
options.browserifyOptions.transform[1][1].presets[0] = [envPreset, { ignoreBrowserslistConfig: true }]
on('file:preprocessor', browserify(options))
} |
Not sure this is solved by doing the above workaround. |
@marcneander The above comment's workaround is intended to fix this issue. Please comment if you have tried the solution and are still experiencing this problem. |
@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. |
Tried this plugin using only chrome as a browser and it works: 'use strict';
const browserify = require('@cypress/browserify-preprocessor');
module.exports = (on, config) => {
let customBrowserify;
on('before:browser:launch', (browser = {}, args) => {
const options = browserify.defaultOptions;
const envPreset = options.browserifyOptions.transform[1][1].presets[0];
options.browserifyOptions.transform[1][1].presets[0] = [
envPreset,
{ ignoreBrowserslistConfig: true, targets: { [browser.name]: browser.majorVersion } },
];
customBrowserify = browserify(options);
});
on('file:preprocessor', (file) => customBrowserify(file));
}; I think however it should be included in cypress. |
Please can you can you Reopen this issue, as it's preferable that a fix is found. As many applications utilise |
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. |
@jennifer-shehane please reconsider again. This break any good testing setup. Something as used as browserlist extends should not require some weird hack to make it work :) |
@chrisbreiding @jennifer-shehane we just ran into this issue in our project. As several others have already mentioned, this is broken in Cypress and therefore this issue is not actually closed. Please reopen. Edit: for those watching, I've gone ahead and opened #5252 since this one seems to have gone stale. |
Agree with others - this should be baked into Cypress without requiring workarounds |
I looked into this a bit. I haven't figured out a solution, but here are my notes for documentation's sake:
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:
|
@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. |
any reason to use |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Still happens |
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:
When running
yarn run cypress run
with only your example tests I get this error (for all tests):Versions
Cypress: 3.1.3
Mac OS: 10.14.2
Node: 11.4.0
The text was updated successfully, but these errors were encountered: