cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

Bump cachedir to 1.3.0 to start removing barriers for FreeBSD #1942

Closed duncan-bayne closed 6 years ago

duncan-bayne commented 6 years ago

Current behavior:

Currently, Cypress doesn't install on FreeBSD:

➜  ~ npm install cypress
> cypress@3.0.1 postinstall /usr/home/duncan/node_modules/cypress
> node index.js --exec install

/usr/home/duncan/node_modules/cachedir/index.js:25
    default: throw new Error('Your OS is currently not supported by node-cachedir.')

Desired behavior:

I would like Cypress to install and run on FreeBSD :)

Versions

Cypress: DEVELOP Browser: Chromium 65.0.3325.181 OS: FreeBSD 11.1-RELEASE GENERIC amd64

Notes

I believe the only impediment to FreeBSD support within the Cypress codebase is that cachedir doesn't support FreeBSD. I've raised a PR to fix this, and it's been merged by the maintainer.

My plan is to upgrade Cypress to use cachedir 2.0.0, and test that on FreeBSD. If it works, I'll raise a PR to resolve this feature request.

If not, I'll see if I can fix any other issues that are preventing FreeBSD support.

As an aside, I'm also helping to get Electron ported to FreeBSD (at this point, just by helping out with testing). This is another pre-requisite for Cypress to run on FreeBSD, but isn't specifically related to this project. See https://github.com/electron/electron/issues/3797 and https://github.com/yzgyyang/freebsd-ports-electron for more details on that work.

kuceb commented 6 years ago

Unfortunately we don't support FreeBSD, and don't have plans to. If cachedir didn't error, you'd quickly get another error from us :smile:

jennifer-shehane commented 6 years ago

I think this issue should remain open in order to gauge interest in FreeBSD support unless it is a complete impossibility for Cypress to support this.

brian-mann commented 6 years ago

Agree with @jennifer-shehane. Keep open and document why FreeBSD doesn't work. Offer workarounds, explanations, or suggestions for other things.

For instance, why is FreeBSD necessary? Are users using it locally on their desktop? Is it command line only and would most often be used on a CI Server? If so, which service? Jenkins? Home grown? Explain!

duncan-bayne commented 6 years ago

@bkucera Perhaps I wan't clear, sorry.

I have recently discovered - and love! - Cypress. I've been evangelizing it at my current client, and with my colleagues at the consultancy where I work. We've started writing end-to-end system tests using it. We're using it in a fairly standard setup - Linux EC2 instances running XVFB and headless Chrome, under Jenkins.

I'm also a FreeBSD user (FreeBSD 11.1 on a Lenovo X220), so I'd like to have Cypress running on my own system, not just the client-supplied Macs and our CI agents.

I'm offering to work on FreeBSD support myself, alone if needs be. My plan is to make fixes to dependencies that don't support FreeBSD (e.g. cachedir), and then to Cypress itself by submitting PRs.

I'm not asking any of the core maintainers to put work into this, beyond reviewing the necessary PRs. This issue is merely for co-ordination and tracking purposes. (E.g. tagging README changes with this issue number).

Could you please re-open this issue?

duncan-bayne commented 6 years ago

@jennifer-shehane @brian-mann Lack of FreeBSD support is actually pretty common with JavaScript libraries and utilities, I've found. Largely because almost no JS devs run FreeBSD :) In my experience almost all of the fixes have been straightforward; things like assumptions made about environment variables and pathnames.

kuceb commented 6 years ago

@duncan-bayne imo the biggest problem isn't even the source code needing changes, it's the resources in CI needed to test everything and build binaries for the extra platform. Although this is an open source project, we don't have access to endless CI infrastructure :neutral_face:

I imagine you will run into this problem a lot when requesting freeBSD support for large projects. Not so much a problem for small libraries without resource intensive e2e tests and binary builds

brian-mann commented 6 years ago

Hey @duncan-bayne - having people excited about contributing to Cypress is exactly what we need while building a community. I appreciate your enthusiasm.

We'd love you to make PR's that expand Cypress to work with FreeBSD. However, while I'm not quite as down on this as @Bkucera, he is right that just accepting PR's is still a long way away from packaging up everything to make it all work together.

We would need to fully support FreeBSD into our build process, which would mean running it in CI as our 4th operating system. We already have several significant investments running across 3 different CI providers just to build, package, and test Cypress core. This alone, no matter what the approach is, is a significant investment. I can say now that working on Cypress full time for the last 4 years, that doing new things using new infrastructure is a major source of problems that often become black holes of time.

Cypress, while practically a giant in and of itself, is also built on the shoulders of other giants - namely node and Chromium via Electron. Node itself almost dropped support for FreeBSD, and the only Chromium ports are community maintained. Browsers are enormously complex pieces of software and the undertaking has been enormous just to get everything working correctly in the major supported operating systems. There is no way we can fix anything broken in the core software packages we leverage, and there is no way we can invest time supporting an operating system that brings its own, new flavor of bugs which will inevitably occur. Even supporting Windows for us (which a large chunk of our users use) has been really taxing on our resources.

Starting with cachedir is a great start, but it is probably .01% of the journey to getting all of this working smoothly. Cypress itself is easily a 100k+ LOC project, on top of node and chromium which easily add another 1M+. I'm not saying it's not possible, I just want to be realistic that because of the low demand for FreeBSD it makes it impossible for our team to invest any resources supporting it. I'm more than happy to merge any PR's you submit (since as long as its green its all good) but I just want to set expectations up front about our commitment. If there was significant demand and as we add team members it might be something we'd look at later on.

At the moment I would suggest you clone the repo yourself (which bypasses the CLI and cachedir) and simply try running Cypress yourself. You'll immediately see if node and Chromium play nicely. From there, you'll have to get Chrome working (and virtually all of the other major browsers) before you can say that for sure it is even possible to get working. Any deviation from the way Chromium works can cause issues that manifest themselves in very difficult to track down bugs and edge cases. As I mentioned, we do this on a regular basis for all 3 major platforms and it is unbelievable how subtle differences can change everything.

Let me know your thoughts, thanks!

brian-mann commented 6 years ago

https://github.com/cypress-io/cypress/pull/1947 fixed cachedir dependency problem

duncan-bayne commented 6 years ago

@brian-mann Agreed with pretty much all your points :)

On the positive side, I think at least limited support (in the sense of functionality, not official support from the Cypress team) may prove easier than you fear. There's an Electron port coming along w/ ambitions to release in time for FreeBSD 12.0, and the Chromium port is reasonably current (65 vs. 67 on stable).

My next steps were going to be:

Once Cypress is at least running, I should hopefully be in a position to assess whether it's more feasible to (a) create a port specifically for Cypress, or (b) provide ad-hoc FreeBSD 'support' by addressing FreeBSD-related issues as they arise for either myself or other users on that OS.

jennifer-shehane commented 6 years ago

@duncan-bayne Could you open a new issue to track the FreeBSD support? With all of the information gleaned above - with checkmarks on the work required for full support? Since we've already closed this issue pertaining to cachedir. Thanks!

duncan-bayne commented 6 years ago

@jennifer-shehane I've actually created an entirely new repository for the port - https://gitlab.com/duncan-bayne/freebsd-ports-cypress. My intent is that once the port is completed and reliable, I will open a PR to have it merged into the Ports tree.

Currently, I'm tracking issues preventing compilation against the following milestone: https://gitlab.com/duncan-bayne/freebsd-ports-cypress/milestones/1

The remaining milestones are really around prep work necessary to get the new Port accepted.

duncan-bayne commented 6 years ago

Note that the way the port works is to fetch the Cypress code from this repository, patch it as necessary, and then compile and install it.

The only code that lives in the freebsd-ports-cypress repository is the code necessary to perform those steps, and also to describe the Port in the FreeBSD ecosystem.

My hope is that when I'm done, there will be almost no need for the patching step.

duncan-bayne commented 6 years ago

@jennifer-shehane If you'd like, I could also open an issue on Cypress, to reflect the progress of the port? Happy to do that if it makes your lives easier.

brian-mann commented 6 years ago

Released in 3.0.2.

dmilith commented 3 years ago

Why closed?