Skip to content

Update to mocha 12.x #7547

Open
Open

Description

@thomashohn

Update to mocha 12.x

Activity

  1. ganeshghutukade-04 commented on Oct 24, 2026

    @ganeshghutukade-04

    Hi! I'd like to work on this. Before opening a PR I wanted to check the approach, since Mocha 12 requires Node ^20.19.0 || >=22.12.0, while Express currently declares "node": ">= 18" and CI runs on Node 18, 19 and 21.

    Which would you prefer?

    1. Bump mocha to ^12 and run the test suite only on Node versions Mocha 12 supports (the engines field stays the same, since it's only a devDependency).
    2. Keep mocha 11 for the older Node versions and only use 12 on newer ones.
    3. Wait until Express drops Node 18.

    Happy to send a PR for whichever you choose.

  2. ganeshghutukade-04 commented on Oct 24, 2026

    @ganeshghutukade-04

    I went ahead and opened #7557 with option 2: Mocha 12 on Node 20+ and 22+, mocha 11 on Node 18, 19 and 21 (via a CI step). Happy to change it if you'd prefer option 1 or 3.

  3. thomashohn commented on Oct 24, 2026

    @thomashohn
    Author

    Depends on if the maintainers want to raise the requirements to Node 20+

  4. ganeshghutukade-04 commented on Oct 25, 2026

    @ganeshghutukade-04

    Thanks! Understood. The PR as it stands keeps Node 18+ working by using mocha 11 on 18, 19 and 21. If you decide to move to Node 20+, I'm happy to update it (drop those CI jobs and the extra step). Just let me know.

  5. thomashohn commented on Oct 26, 2026

    @thomashohn
    Author

    Any thoughts on this one @krzysdz ?

  6. krzysdz commented on Oct 27, 2026

    @krzysdz
    Contributor

    Express 5 must run on Node.js 18+ and this includes the CI (otherwise how would we know if there are problems). In other repos I've seen matrix.include that specified package overrides for older Node.js version (serve-index, compression, body-parser 1.x).

    In this case I'd use something like this:

          matrix:
            os: [ubuntu-latest, windows-latest]
            node-version: [18, 19, 20, 21, 22, 23, 24, 25, 26]
            # Node.js release schedule: https://nodejs.org/en/about/releases/
            include:
            - node-version: 18
              npm-i: mocha@^11.8.0
            - node-version: 19
              npm-i: mocha@^10.8.2
            - node-version: 21
              npm-i: mocha@^11.8.0

    with additional step before npm install:

          - name: Install npm module(s) ${{ matrix.npm-i }}
            run: npm install --save-dev ${{ matrix.npm-i }}
            if: matrix.npm-i != ''
    
          - name: Install dependencies
            run: npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions