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

[BREAKING] Drop support for Node.js 10 and 12, ensure in the CI tests are run under multiple Node.js versions #94

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Jan 6, 2025

Let's modernize this repository 🙌🏻

Starting first with CI improvments

@Kocal
Copy link
Member Author

Kocal commented Jan 6, 2025

image
Node.js 10 and Node.js 12 jobs are failing because [email protected] is incompatible with node < 14.15.0:

  • error [email protected]: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "10.24.1"
  • error [email protected]: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "12.22.12"

yarn why pretty-format:

➜  symfony-stimulus-bridge git:(imp-ci-node-versions) yarn why pretty-format
yarn why v1.22.22
[1/4] 🤔  Why do we have the module "pretty-format"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "pretty-format"
info Reasons this module exists
   - Hoisted from "jest-config#pretty-format"
   - Hoisted from "jest-diff#pretty-format"
   - Hoisted from "jest-validate#pretty-format"
   - Hoisted from "@symfony#stimulus-testing#@testing-library#dom#pretty-format"
   - Hoisted from "jest-config#jest-jasmine2#pretty-format"
   - Hoisted from "jest-runner#jest-leak-detector#pretty-format"
   - Hoisted from "@jest#console#jest-message-util#pretty-format"
   - Hoisted from "@jest#core#jest-message-util#pretty-format"
   - Hoisted from "@jest#fake-timers#jest-message-util#pretty-format"
   - Hoisted from "jest-runner#jest-message-util#pretty-format"
   - Hoisted from "@jest#core#jest-snapshot#pretty-format"
   - Hoisted from "jest-config#jest-jasmine2#jest-each#pretty-format"
   - Hoisted from "jest-config#jest-jasmine2#jest-matcher-utils#pretty-format"
   - Hoisted from "@jest#core#jest-snapshot#jest-matcher-utils#pretty-format"
   - Hoisted from "jest-config#jest-jasmine2#jest-message-util#pretty-format"
   - Hoisted from "jest-config#jest-jasmine2#jest-snapshot#pretty-format"
   - Hoisted from "@jest#core#jest-resolve-dependencies#jest-snapshot#pretty-format"
   - Hoisted from "jest-runner#jest-runtime#jest-snapshot#pretty-format"
   - Hoisted from "@jest#core#jest-resolve-dependencies#jest-snapshot#jest-matcher-utils#pretty-format"
   - Hoisted from "jest-runner#jest-runtime#jest-snapshot#jest-matcher-utils#pretty-format"
   - Hoisted from "jest-config#@jest#test-sequencer#jest-runtime#jest-message-util#pretty-format"
   - Hoisted from "@jest#core#jest-resolve-dependencies#jest-snapshot#jest-message-util#pretty-format"
   - Hoisted from "jest-config#@jest#test-sequencer#jest-runtime#jest-snapshot#pretty-format"
   - Hoisted from "jest-config#@jest#test-sequencer#jest-runtime#jest-snapshot#jest-matcher-utils#pretty-format"
info Disk size without dependencies: "152KB"
info Disk size with unique dependencies: "332KB"
info Disk size with transitive dependencies: "3.16MB"
info Number of shared dependencies: 13
=> Found "jest-each#[email protected]"
info This module exists because "jest-each" depends on it.
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-matcher-utils#[email protected]"
info Reasons this module exists
   - "jest-matcher-utils" depends on it
   - Hoisted from "jest-matcher-utils#jest-diff#pretty-format"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-message-util#[email protected]"
info This module exists because "jest-message-util" depends on it.
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-snapshot#[email protected]"
info Reasons this module exists
   - "jest-snapshot" depends on it
   - Hoisted from "jest-snapshot#jest-diff#pretty-format"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest#[email protected]"
info Reasons this module exists
   - "jest#@jest#core#jest-config" depends on it
   - Hoisted from "jest#@jest#core#jest-config#pretty-format"
   - Hoisted from "jest#@jest#core#jest-validate#pretty-format"
   - Hoisted from "jest#@jest#core#jest-config#jest-jasmine2#pretty-format"
   - Hoisted from "jest#@jest#core#jest-runner#jest-leak-detector#pretty-format"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-cli#[email protected]"
info Reasons this module exists
   - "jest#jest-cli#jest-config" depends on it
   - Hoisted from "jest#jest-cli#jest-config#pretty-format"
   - Hoisted from "jest#jest-cli#jest-validate#pretty-format"
   - Hoisted from "jest#jest-cli#jest-config#jest-jasmine2#pretty-format"
   - Hoisted from "jest#jest-cli#@jest#core#jest-runner#jest-leak-detector#pretty-format"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-runtime#[email protected]"
info Reasons this module exists
   - "jest-runtime#jest-resolve#jest-validate" depends on it
   - Hoisted from "jest-runtime#jest-resolve#jest-validate#pretty-format"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "jest-circus#[email protected]"
info This module exists because "jest#@jest#core#jest-config#jest-circus" depends on it.
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "324KB"
info Number of shared dependencies: 4
=> Found "@types/jest#[email protected]"
info Reasons this module exists
   - "@symfony#stimulus-testing#@testing-library#jest-dom#@types#testing-library__jest-dom#@types#jest" depends on it
   - Hoisted from "@symfony#stimulus-testing#@testing-library#jest-dom#@types#testing-library__jest-dom#@types#jest#expect#jest-matcher-utils#pretty-format"
   - Hoisted from "@symfony#stimulus-testing#@testing-library#jest-dom#@types#testing-library__jest-dom#@types#jest#expect#jest-message-util#pretty-format"
   - Hoisted from "@symfony#stimulus-testing#@testing-library#jest-dom#@types#testing-library__jest-dom#@types#jest#expect#jest-matcher-utils#jest-diff#pretty-format"
info Disk size without dependencies: "108KB"
info Disk size with unique dependencies: "216KB"
info Disk size with transitive dependencies: "836KB"
info Number of shared dependencies: 4
✨  Done in 0.23s.

Given the yarn why:

Off-topic:

I'm absolutely not a fan of this kind of library that pack pinned and opinionated dependencies, I have some experience with that and it's a hell to maintain and to use in other projects.
I will see what I do with @symfony/stimulus-testing, but I will surely remove dependencies on Babel and Jest

@Kocal Kocal added the DX label Jan 6, 2025
@Kocal
Copy link
Member Author

Kocal commented Jan 9, 2025

And now, it's:

  • Node.js 10: error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "10.24.1"
  • Node.js 12: test can't be executed
FAIL test/index.test.ts
  ● Test suite failed to run

    Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /home/runner/work/stimulus-bridge/stimulus-bridge/node_modules/@adobe/css-tools/dist/index.cjs:122
                }, options?.source || '');
                           ^

    SyntaxError: Unexpected token '.'

      10 | 'use strict';
      11 |
    > 12 | import '@symfony/stimulus-testing/setup';
         | ^
      13 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (node_modules/@testing-library/jest-dom/dist/utils.js:21:17)
      at Object.<anonymous> (node_modules/@testing-library/jest-dom/dist/to-be-in-the-dom.js:7:14)
      at Object.<anonymous> (node_modules/@testing-library/jest-dom/dist/matchers.js:168:21)
      at Object.<anonymous> (node_modules/@testing-library/jest-dom/dist/extend-expect.js:3:42)
      at Object.<anonymous> (node_modules/@testing-library/jest-dom/dist/index.js:3:1)
      at Object.<anonymous> (node_modules/@symfony/stimulus-testing/src/setup.js:14:1)
      at Object.<anonymous> (node_modules/@symfony/stimulus-testing/setup.js:1:83)
      at Object.<anonymous> (test/setup.js:12:1)

Let's drop support of Node.js 10 and 12, it's 2025, and these versions have not been supported (either by the Node.js team, or by the ecosystem) for years.

@Kocal Kocal force-pushed the imp-ci-node-versions branch 2 times, most recently from 618800e to ae6f491 Compare January 9, 2025 07:34
@Kocal Kocal changed the title [CI] Ensure tests are run under multiple Node.js versions [BREAKING] Drop support for Node.js 10 and 12, ensure in the CI tests are run under multiple Node.js versions Jan 9, 2025
@Kocal Kocal force-pushed the imp-ci-node-versions branch from ae6f491 to 0db4ba3 Compare January 9, 2025 23:20
@Kocal Kocal merged commit 9bf462e into symfony:main Jan 9, 2025
5 checks passed
@Kocal Kocal deleted the imp-ci-node-versions branch January 9, 2025 23:21
Kocal added a commit that referenced this pull request Jan 18, 2025
This PR was merged into the main branch.

Discussion
----------

[BREAKING] Drop Node.js 14 and 16 support

Following #94, let's continue to drop old unmaintained [Node.js versions](https://nodejs.org/en/about/previous-releases):
<img width="757" alt="image" src="https://github.com/user-attachments/assets/1730bb19-02ce-4651-89b8-7acf84dfb720" />

Commits
-------

68da84e [BREAKING] Drop Node.js 14 and 16 support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant