Skip to content

Move cypress to client folder#3566

Merged
gabrieldutra merged 11 commits into
masterfrom
eslint-cypress
Mar 24, 2019
Merged

Move cypress to client folder#3566
gabrieldutra merged 11 commits into
masterfrom
eslint-cypress

Conversation

@gabrieldutra

@gabrieldutra gabrieldutra commented Mar 10, 2019

Copy link
Copy Markdown
Member

What type of PR is this? (check all applicable)

  • Other

Description

Moved Cypress to client folder, so eslint works for it by default.

Related Tickets & Documents

Nope

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Nope

@gabrieldutra gabrieldutra self-assigned this Mar 10, 2019
@ghost ghost added the in progress label Mar 10, 2019
@ranbena

ranbena commented Mar 11, 2019

Copy link
Copy Markdown
Contributor

@arikfr we spoke about this a few weeks ago. I think we should consider moving .eslintrc.js to the root folder of the repo.

@gabrieldutra gabrieldutra changed the title Add eslint config to Cypress folder WIP: Move eslint config to root folder Mar 12, 2019
@gabrieldutra

Copy link
Copy Markdown
Member Author

It seems I missed some config for CodeClimate (it only caught my test for cypress). It also made eslint required for build. I'll need to check this more calmly.

@ranbena

ranbena commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

How about instead git mv cypress client/?

@arikfr

arikfr commented Mar 12, 2019

Copy link
Copy Markdown
Member

How about instead git mv cypress client/?

This crossed my mind :-) But I thought that moving eslint configuration will be easier.

@arikfr

arikfr commented Mar 12, 2019

Copy link
Copy Markdown
Member

It also made eslint required for build.

It should be.

@ranbena

ranbena commented Mar 12, 2019

Copy link
Copy Markdown
Contributor

How about instead git mv cypress client/?

Would also make lint-staged config easier with "ignore":

  "lint-staged": {
    "linter": {
      "client/**/*.{js,jsx}": [
        "npm run lint:base",
        "npm run test -- --bail --findRelatedTests"
      ]
    },
    "ignore": ["client/dist/*"]
  }

rather than having to set two linter paths and repeating the config:

  "lint-staged": {
    "client/app/**/*.{js,jsx}": [
      "npm run lint:base",
      "npm run test -- --bail --findRelatedTests"
    ],
  "cypress/**/*.{js,jsx}": [
      "npm run lint:base",
      "npm run test -- --bail --findRelatedTests"
    ]
  }

@arikfr

arikfr commented Mar 12, 2019

Copy link
Copy Markdown
Member

@ranbena 👍

@gabrieldutra

gabrieldutra commented Mar 14, 2019

Copy link
Copy Markdown
Member Author

rather than having to set two linter paths and repeating the config:

Not sure this would be a good approach, but it did work 😅

"lint-staged": {
  "{client/app,cypress}/**/*.{js,jsx}": [
    "npm run lint:base",
    "npm run test -- --bail --findRelatedTests"
  ]
}

But I'll go with cypress in client folder option 😆

@gabrieldutra gabrieldutra changed the title WIP: Move eslint config to root folder Move cypress to client folder Mar 14, 2019
@ranbena

ranbena commented Mar 14, 2019

Copy link
Copy Markdown
Contributor

@arikfr this lgtm. You cool with this?

@ranbena
ranbena requested a review from arikfr March 14, 2019 06:06

@arikfr arikfr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. See comment on paths.

Comment thread cypress.json
"pluginsFile": "client/cypress/plugins/index.js",
"screenshotsFolder": "client/cypress/screenshots",
"videosFolder": "client/cypress/videos",
"supportFile": "client/cypress/support/index.js"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cypress assumes that it's in the root folder? Maybe there is a way to set its path/context once to avoid having to maintain all these folders/files mapping?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps fileServerFolder: "client/"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cypress assumes that it's in the root folder? Maybe there is a way to set its path/context once to avoid having to maintain all these folders/files mapping?

Yes 😕, I didn't like that I had to change all of those either.

The way I see that could probably set the path/context is changing npm run cypress open and npm run cypress run to run from another path. However, the current option seems better than that. With cypress knowing it's not in the root folder, you can run still run it using other commands: cypress open (in case you have it global) or npx cypress open.

LMK if you had something simpler in mind

Perhaps fileServerFolder: "client/"?

I thought about this one too. I actually didn't get what's its purpose, but changing it doesn't affect what we want. Cypress keeps thinking it's in the root folder and, since there's no cypress folder in there, it creates it in an empty state.

@ranbena

ranbena commented Mar 23, 2019

Copy link
Copy Markdown
Contributor

@arikfr I'd really like this to land asap.
Any suggestions on how to improve the config?

@arikfr

arikfr commented Mar 24, 2019

Copy link
Copy Markdown
Member

I didn't realize this was waiting for me. I just asked if there is another option :)
Feel free to merge when you & @gabrieldutra feel it's ready.

@gabrieldutra

Copy link
Copy Markdown
Member Author

I'm going to merge this once CI is done, ongoing cypress' PRs will be affected @ranbena & @arikfr. There are some eslint issues in search_query_spec.js, I chose not to fix them in order to avoid diff issues :)

@arikfr

arikfr commented Mar 24, 2019

Copy link
Copy Markdown
Member

There are some eslint issues in search_query_spec.js, I chose not to fix them in order to avoid diff issues :)

Once merged, I'll rebase #3635 and fix the lint errors.

@gabrieldutra
gabrieldutra merged commit 25910e7 into master Mar 24, 2019
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants