Skip to content
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

Update Cypress and Jest versions and remove Node 8 support #543

Merged
merged 15 commits into from Aug 26, 2020

Conversation

luisherranz
Copy link
Member

@luisherranz luisherranz commented Aug 25, 2020

What:

I've updated Cypress and Jest to their latest versions.

I've deprecated the URL import from "frontity", which was the only thing we had for backward compatibility with Node 8.

I've also fixed a couple of issues with Cypress e2e tests:

  • Remove WP CLI containers after run.
  • Remove all the containers (WP, MySQL, WP CLI) after Cypress has sucessfully run.
  • Remove all the containers after an error.

Why:

We've made several changes to our test system, I think it's good to keep it up to date with the latest Jest/Cypress versions.

Nobody supports Node 8 anymore. I think it's not even on maintenance anymore. All serverless platforms have updated to either Node 10 or Node 12. https://nodejs.org/en/about/releases/

How:

Simply by updating the dependencies and creating a wrapper around URL to warn about the deprecation.

Tasks:

Unrelated Tasks

  • TSDocs
  • TypeScript
  • End to end tests
  • TypeScript tests
  • Update starter themes
  • Update other packages
  • Open an issue for this feature in the docs repo
  • Update community discussions

Additional Comments

I've added a dummy test to the end of the wp-basic-tests e2e tests, because if not Cypress was ignoring the previous test. I guess this is a bug in Cypress, maybe related to the after function.

It looks like it was useful to remove the container after the run.
It seems like a bug in Cypress when you use the `after` function.
@luisherranz luisherranz self-assigned this Aug 25, 2020
@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2020

🦋 Changeset is good to go

Latest commit: a178a8c

We got this.

This PR includes changesets to release 1 package
Name Type
frontity Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@luisherranz luisherranz changed the title Update cypress jest Update Cypress and Jest versions Aug 25, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 1 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 1 total


[warning] jest/no-disabled-tests

Disallow disabled tests


Report generated by eslint-plus-action

Skip because it started failing when we upgraded to Jest 26, but we are
going to remove it once we merge this PR anyway:
#415.
@luisherranz luisherranz removed the request for review from DAreRodz August 25, 2020 09:46
@luisherranz luisherranz marked this pull request as draft August 25, 2020 09:46
@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #543 into dev will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
packages/frontity/src/index.ts 100.00% <100.00%> (ø)
packages/frontity/src/utils/url.ts 100.00% <100.00%> (ø)
packages/head-tags/src/utils/index.ts 97.65% <100.00%> (-0.10%) ⬇️
packages/wp-comments/src/index.ts 92.99% <100.00%> (ø)
packages/wp-source/src/actions.ts 91.76% <100.00%> (ø)
packages/components/script.tsx 0.00% <0.00%> (ø)
packages/google-analytics/src/index.ts 29.17% <0.00%> (ø)
packages/analytics/src/components/index.tsx 26.67% <0.00%> (ø)
packages/google-tag-manager-analytics/src/index.ts 0.00% <0.00%> (ø)
... and 1 more

@luisherranz luisherranz changed the title Update Cypress and Jest versions Update Cypress and Jest versions and remove Node 8 support Aug 25, 2020
@luisherranz luisherranz marked this pull request as ready for review August 25, 2020 16:03
@luisherranz luisherranz added this to In progress in Sprint 6 via automation Aug 25, 2020
@luisherranz luisherranz moved this from In progress to In review in Sprint 6 Aug 25, 2020
/* eslint-disable */
/*
* TSDocs will be added in this branch:
* https://github.com/frontity/frontity/tree/package-name
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? I see that the last commit on that branch was 8 days ago.

Oh, I see that it's in other files as well. I assume that you had a good reason for doing this but in general I would say that we shouldn't keep track of tasks this way because it's asking for trouble once it's merged and someone forgets 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, it's not a good approach. I should've copied the TSDocs from that branch 👍

@@ -25,7 +25,7 @@ module.exports = (on, config) => {
installPlugin({ name, version }) {
return (async () => {
await execa.command(
`docker-compose run wpcli wp plugin install ${name}${
`docker-compose run --rm wpcli wp plugin install ${name}${
Copy link
Member

Choose a reason for hiding this comment

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

👍 when running locally it leaves lotsa containers behind, good point.

@@ -9,7 +9,7 @@ const mockedHe = he as jest.Mocked<typeof he>;
describe("decode", () => {
beforeEach(() => {
mockedHe.decode.mockReset();
mockedHe.decode.mockImplementation(require.requireActual("he").decode);
mockedHe.decode.mockImplementation(jest.requireActual("he").decode);
Copy link
Member

Choose a reason for hiding this comment

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

Just leaving this for reference: jestjs/jest#9854. This change is because of jest deprecating require.requireActual()

Copy link
Member

@michalczaplinski michalczaplinski left a comment

Choose a reason for hiding this comment

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

Not strictly related to the changes in the PR, but I've noticed that the URL constructor is not supported at all in IE so as far as I can tell that means that we don't support IE at all.

Based on https://community.frontity.org/t/frontity-support-for-ie9/2540/5?u=mmczaplinski we decided to support IE11 SSR-only so that would break this promise.

@luisherranz
Copy link
Member Author

luisherranz commented Aug 26, 2020

Based on https://community.frontity.org/t/frontity-support-for-ie9/2540/5?u=mmczaplinski we decided to support IE11 SSR-only so that would break this promise.

The client-code it's not executed in IE because it's server-side only. So URL is safe to use because it will run only in the server 👍

This hasn't changed in this PR. We were already using window.URL for the client before: https://github.com/frontity/frontity/blob/dev/packages/core/src/config/webpack/externals.ts#L12


Thanks for the review and the comments @michalczaplinski! 🙂

@luisherranz luisherranz merged commit 18465df into dev Aug 26, 2020
Sprint 6 automation moved this from In review to Done Aug 26, 2020
@luisherranz luisherranz deleted the update-cypress-jest branch August 26, 2020 06:54
@github-actions
Copy link
Contributor

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 1 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 1 total


[warning] jest/no-disabled-tests

Disallow disabled tests


Report generated by eslint-plus-action

@michalczaplinski
Copy link
Member

The client-code it's not executed in IE because it's server-side only. So URL is safe to use because it will run only in the server 👍

oh, I think I was tired yesterday since the answer was in my own question basically 🤦‍♂️ Thanks @luisherranz :)

@luisherranz
Copy link
Member Author

oh, I think I was tired yesterday since the answer was in my own question basically

Haha, that's true 😄

This was referenced Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Sprint 6
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants