Dependency update: Update Mocha to version 8 #3146
Conversation
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. |
There was a problem hiding this 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?
It seems like maybe we could consider it for 5.2.0. |
There was a problem hiding this 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
)
- Behavior of all tests (say 5-10) passing.
- Behavior of a couple tests being skipped (including
Contract.skip
). - Behavior of
only
testing certain tests (includingContract.only
). - 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.
There was a problem hiding this 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).
There was a problem hiding this 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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
This is a PR to update all packages (except the debugger) to version 8.
Some things to note:
useColors
options looks like it was deprecated and therefore removed here (see breaking changes here)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.