getgauge / gauge-js

JavaScript language plugin for Gauge
MIT License
81 stars 39 forks source link

Bump chai from 4.4.1 to 5.1.1 #655

Closed dependabot[bot] closed 2 months ago

dependabot[bot] commented 3 months ago

Bumps chai from 4.4.1 to 5.1.1.

Release notes

Sourced from chai's releases.

v5.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/chaijs/chai/compare/v5.1.0...v5.1.1

v5.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/chaijs/chai/compare/v5.0.3...v5.1.0

v5.0.3

Fix bad v5.0.2 publish.

Full Changelog: https://github.com/chaijs/chai/compare/v5.0.2...v5.0.3

v5.0.2

What's Changed

Full Changelog: https://github.com/chaijs/chai/compare/v5.0.1...v5.0.2

v5.0.0

BREAKING CHANGES

  • Chai now only supports EcmaScript Modules (ESM). This means your tests will need to either have import {...} from 'chai' or import('chai'). require('chai') will cause failures in nodejs. If you're using ESM and seeing failures, it may be due to a bundler or transpiler which is incorrectly converting import statements into require calls.

... (truncated)

Commits


Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

zabil commented 2 months ago

@dependabot rebase

zabil commented 2 months ago

This is stuck because the latest version of chai switched to ES modules, and now I'm getting an error.

Exception during run: Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/zabilcm/projects/gauge-js/node_modules/chai/chai.js from /Users/zabilcm/projects/gauge-js/test/custom-message-registry-test.js not supported.
Instead change the require of chai.js in /Users/zabilcm/projects/gauge-js/test/custom-message-registry-test.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/zabilcm/projects/gauge-js/test/custom-message-registry-test.js:1:14)
    at async formattedImport (/Users/zabilcm/projects/gauge-js/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/Users/zabilcm/projects/gauge-js/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/Users/zabilcm/projects/gauge-js/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/Users/zabilcm/projects/gauge-js/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/Users/zabilcm/projects/gauge-js/node_modules/mocha/lib/cli/run.js:370:5) {
  code: 'ERR_REQUIRE_ESM'

The best way to handle this, since other dependencies might do the same, is to change gauge js to an ES module and increase the major version number. This will make sure the dependencies can be updated without getting stuck.

What do you think?

zabil commented 2 months ago

Also being discussed on hacker news today

https://borischerny.com/javascript,/typescript/2024/06/19/ES-Modules-Are-A-Mess.html

chadlwilson commented 2 months ago

Yeah, this has been an ongoing debate for years now, and almost a joke at this point when trying to wade through babel, webpack, typescript, corejs configurations etc and make all this stuff actually work (if you have any older versions of anything).

I'm not sure I have a sufficiently well educated opinion yet on what should happen for gauge-js itself but definitely seems like moving to an ES module make sense and probably has limited risk given the way gauge-js is used? (likely with Node only, on dev machines, as a top level dependency in a package.json)

Given I moved Node 16 to minimum back in Jan we should be relatively clean to move anyway.

zabil commented 2 months ago

Yeah I think the risk is limited. I'd like investigate this and hopefully send a PR. Will create an issue to track this.

chadlwilson commented 2 months ago

Thought it might be easy, but seems at least not trivial - experiment at https://github.com/getgauge/gauge-js/pull/667

chadlwilson commented 2 months ago

Feel free to butcher that branch at will :-)

zabil commented 2 months ago

I think it's because of this line

 ].concat(module.paths.filter((p) => p.indexOf(".gauge") < 0));

module.exports module.paths no longer available in es modules.

chadlwilson commented 2 months ago

Yup, it is - that's just as far as I got up to before trying to figure out what that is doing and the consequences for those using the plugin, and thus gave up for now :-)

chadlwilson commented 2 months ago

We'll do this within #667 since it's coupled.

dependabot[bot] commented 2 months ago

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.