Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Dependency update: Update Mocha to version 8 #3146

Merged
merged 9 commits into from Jul 8, 2020
Merged

Conversation

eggplantzzz
Copy link
Contributor

@eggplantzzz eggplantzzz commented Jul 6, 2020

This is a PR to update all packages (except the debugger) to version 8.

Some things to note:

  • The useColors options looks like it was deprecated and therefore removed here (see breaking changes here)
  • Mocha 8 is compatible with Node >= 10.12.0 and not Node 13
  • The debugger package was left at version 5.x.x because it will require a bit more work to deal with deps like mocha-webpack (sorry @haltman-at).

This will be a breaking change as this will force truffle test to require the Node versions listed above and keep Truffle from supporting Node v8.

@eggplantzzz
Copy link
Contributor Author

It seems to me that we can also remove all the Node 8 jobs from CI. This would be all the Travis stuff I believe.

Copy link
Contributor

@CruzMolina CruzMolina left a comment

Choose a reason for hiding this comment

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

Requesting changes in core/lib/test.

Looks like this might need to wait for v6?

.github/workflows/nodejs.yml Show resolved Hide resolved
packages/core/lib/test.js Show resolved Hide resolved
@eggplantzzz
Copy link
Contributor Author

It seems like maybe we could consider it for 5.2.0.

packages/core/lib/test.js Outdated Show resolved Hide resolved
@CruzMolina CruzMolina self-requested a review July 7, 2020 14:54
Copy link
Contributor

@CruzMolina CruzMolina left a comment

Choose a reason for hiding this comment

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

Planning to manually stress-test this a bit.

We probably should test the following cases:

From the terminal and within REPL contexts (console and/or develop)

  1. Behavior of all tests (say 5-10) passing.
  2. Behavior of a couple tests being skipped (including Contract.skip).
  3. Behavior of only testing certain tests (including Contract.only).
  4. Behavior when there's failing tests.

Each sets of behavior should probably be tested on Node 10, 12, & 14 LTS.

Perhaps we also want there to be a helpful error when attempting to run truffle test on Node 8.

@CruzMolina CruzMolina dismissed their stale review July 7, 2020 15:05

Changes were made!

Copy link
Contributor

@CruzMolina CruzMolina left a comment

Choose a reason for hiding this comment

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

After QA'ing a bit, everything seems to check out and I have not seen this to be an actual breaking change to end users.

It appears the mocha CLI requires Node v10.12.0 and up, but not the API.

The repl listener issue is still present in mocha v8.x for versions of Node > 12.3.0 (mochajs/mocha#4009).

Copy link
Contributor

@CruzMolina CruzMolina left a comment

Choose a reason for hiding this comment

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

As a separate issue, it should probably be decided whether truffle is formally dropping support for Node 8.

If so, the Node 8.x GHA CI can be dropped and the Travis jobs bumped to Node 10.

As an aside, the only pkgs that need mocha bumped to provide the upgrade to truffle end-users are @truffle/core & truffle.

@@ -54,7 +54,7 @@
"ganache-core": "2.10.2",
"glob": "^7.1.4",
"hdkey": "^1.1.0",
"mocha": "5.1.1",
"mocha": "8.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

This mocha (the one in core, the dependency, not the dev dependency) is exposed to the user... so isn't upgrading this one a breacking change? Should this one be left as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

There could be some edge cases when doing customizable mocha-things (mocha-parallel tests?), but so far the core CLI functionality when running truffle test seems about the same.

I haven't checked the Library API we expose (truffle.test...), but last I checked it's undocumented and still considered experimental. 🤷‍♂️

Maybe we should dig in and outline what exactly the breaking changes are between v5.2.0 and v8.
FWIW, I don't think truffle has ever fully supported the complete features of mocha.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants